text:
#region Apache License
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to you under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using NJetty.Commons;

namespace NJetty.Util.Util
{

    ///
    /// Circualar Array Based Queue, the array is grawable.
    ///
    /// <author>
    ///     Leopoldo Lee Agdeppa III
    /// </author>
    /// <date>
    /// November 2008
    /// </date>
    public class ArrayQueue<T>// : IList<T>
    {
        const int DEFAULT_CAPACITY = 64;
        const int DEFAULT_GROWTH = 32;
        object _lock = new object();
        T[] _elements;
        int _nextE;
        int _nextSlot;
        int _size;
        int _growCapacity;

        #region Constructors

        public ArrayQueue()
        {
            _elements = new T[DEFAULT_CAPACITY];
            _growCapacity = 32;
        }

        public ArrayQueue(int capacity)
        {
            _elements = new T[capacity];
            _growCapacity = -1;
        }

        public ArrayQueue(int initCapacity, int growBy)
        {
            _elements = new T[initCapacity];
            _growCapacity = growBy;
        }

        public ArrayQueue(int initCapacity, int growBy, object objectLock)
        {
            _elements = new T[initCapacity];
            _growCapacity = growBy;
            _lock = objectLock;
        }

        #endregion

        #region CustomImplementations

        public int Capacity
        {
            get { return _elements.Length; }
        }

        public T Element()
        {
            lock (_lock)
            {
                if (_nextSlot == _nextE)
                    throw new NoSuchElementException();
                return _elements[_nextE];
            }
        }

        public bool Offer(T item)
        {
            lock (_lock)
            {
                _size++;
                _elements[_nextSlot++] = item;
                if (_nextSlot == _elements.Length)
                {
                    _nextSlot = 0;
                }
                if (_nextSlot == _nextE)
                {
                    if (_growCapacity <= 0)
                        return false;

                    T[] elements = new T[_elements.Length + _growCapacity];

                    int split = _elements.Length - _nextE;
                    if (split > 0)
                    {
                        Array.Copy(_elements, _nextE, elements, 0, split);
                    }
                    if (_nextE != 0)
                    {
                        Array.Copy(_elements, 0, elements, split, _nextSlot);
                    }

                    _elements = elements;
                    _nextE = 0;
                    _nextSlot = _size;
                }

                return true;
            }
        }

        public T Peek()
        {
            lock (_lock)
            {
                if (_nextSlot == _nextE)
                    return default(T);
                return _elements[_nextE];
            }
        }

        public T Poll()
        {
            return Dequeue();
        }

        public T Dequeue()
        {
            lock (_lock)
            {
                if (_size == 0)
                    return default(T);
                T e = _elements[_nextE];
                _elements[_nextE] = default(T);
                _size--;
                if (++_nextE == _elements.Length)
                    _nextE = 0;
                return e;
            }
        }

        public T Remove()
        {
            lock (_lock)
            {
                if (_nextSlot == _nextE)
                    throw new NoSuchElementException();
                T e = _elements[_nextE++];
                if (_nextE == _elements.Length)
                    _nextE = 0;
                return e;
            }
        }

        public bool IsEmpty
        {
            get
            {
                lock (_lock)
                {
                    return _size == 0;
                }
            }
        }

        public T GetUnsafe(int index)
        {
            int i = _nextE + index;
            if (i >= _elements.Length)
                i -= _elements.Length;
            return _elements[i];
        }

        public override string ToString()
        {
            List<string> list = new List<string>();
            foreach (T item in this)
            {
                list.Add(item.ToString());
            }

            return LazyList.ToString(list);
        }

        #endregion

        #region Helper

        protected void Grow()
        {
            if (_growCapacity <= 0)
            {
                throw new InvalidOperationException("Full");
            }

            T[] elements = new T[_elements.Length + _growCapacity];

            int split = _elements.Length - _nextE;

            if (split > 0)
            {
                Array.Copy(_elements, _nextE, elements, 0, split);
            }

            if (_nextE != 0)
            {
                Array.Copy(_elements, 0, elements, split, _nextSlot);
            }

            _elements = elements;
            _nextE = 0;
            _nextSlot = _size;
        }

        #endregion

        #region IList<E> Members

        public int IndexOf(T item)
        {
            if (item == null)
            {
                return -1;
            }

            lock (_lock)
            {
                for (int i = 0; i < _size; i++)
                {
                    if (item.Equals(GetUnsafe(i)))
                    {
                        return i;
                    }
                }

                return -1;
            }

        }

        public void Insert(int index, T item)
        {
            lock (_lock)
            {
                if (index < 0 || index > _size)
                    throw new IndexOutOfRangeException("!(" + 0 + "<" + index + "<=" + _size + ")");

                if (index == _size)
                {
                    Add(item);
                }
                else
                {
                    int i = _nextE + index;
                    if (i >= _elements.Length)
                        i -= _elements.Length;

                    _size++;
                    _nextSlot++;
                    if (_nextSlot == _elements.Length)
                        _nextSlot = 0;

                    if (_nextSlot == _nextE)
                        Grow();

                    if (i < _nextSlot)
                    {
                        // 0                         _elements.length
                        //       _nextE.....i..._nextSlot
                        // 0                         _elements.length
                        // ..i..._nextSlot   _nextE..........
                        Array.Copy(_elements, i, _elements, i + 1, _nextSlot - i);
                        _elements[i] = item;
                    }
                    else
                    {
                        // 0                         _elements.length
                        // ......_nextSlot   _nextE.....i....
                        if (_nextSlot > 0)
                        {
                            Array.Copy(_elements, 0, _elements, 1, _nextSlot);
                            _elements[0] = _elements[_elements.Length - 1];
                        }

                        Array.Copy(_elements, i, _elements, i + 1, _elements.Length - i - 1);
                        _elements[i] = item;
                    }
                }
            }
        }

        public T this[int index]
        {
            get
            {
                lock (_lock)
                {
                    if (index < 0 || index >= _size)
                        throw new IndexOutOfRangeException("!(" + 0 + "<" + index + "<=" + _size + ")");
                    int i = _nextE + index;
                    if (i >= _elements.Length)
                        i -= _elements.Length;
                    return _elements[i];
                }
            }
            set
            {
                lock (_lock)
                {
                    if (index < 0 || index >= _size)
                        throw new IndexOutOfRangeException("!(" + 0 + "<" + index + "<=" + _size + ")");

                    int i = _nextE + index;
                    if (i >= _elements.Length)
                        i -= _elements.Length;
                    T old = _elements[i];
                    _elements[i] = value;
                }
            }
        }

        #endregion

        #region ICollection<E> Members

        public void AddUnsafe(T item)
        {
            _size++;
            _elements[_nextSlot++] = item;
            if (_nextSlot == _elements.Length)
            {
                _nextSlot = 0;
            }
            if (_nextSlot == _nextE)
            {
                Grow();
            }
        }

        public void Add(T item)
        {
            Enqueue(item);
        }

        public int Enqueue(T item)
        {
            lock (_lock)
            {
                AddUnsafe(item);

                return _size;
            }
        }

        public void Clear()
        {
            lock (_lock)
            {
                _size = 0;
                _nextE = 0;
                _nextSlot = 0;
            }
        }

        public bool Contains(T item)
        {

            lock (_lock)
            {
                if (item == null)
                {
                    throw new ArgumentNullException();
                }

                for (int i = 0; i < _size; i++)
                {
                    if (item.Equals(GetUnsafe(i)))
                    {
                        return true;
                    }
                }

                return false;
            }
        }

        //public void CopyTo(T[] array, int arrayIndex)
        //{
        //    throw new NotImplementedException();
        //}

        public int Count
        {
            get
            {
                lock (_lock)
                {
                    return _size;
                }
            }
        }

        public bool IsReadOnly
        {
            get { return false; }
        }

        void RemoveRealIndex(int i)
        {
            if (i < _nextSlot)
            {
                // copy the array overwriting
                // i with i+1 to (i+n) with (n+1) until with the length of (_nextSlot-1)
                // in other words move the array from i+1 one step backward until (_nextSlot-1)
                Array.Copy(_elements, i + 1, _elements, i, _nextSlot - i);

                _nextSlot--;
                _size--;
            }
            else
            {
                // copy the array overwriting
                // i with i+1 to (i+n) with (n+1) until with the length of ((_elements.Length-i)-1)
                // in other words move the array from i+1 one step backward until ((_elements.Length-i)-1)
                Array.Copy(_elements, i + 1, _elements, i, (_elements.Length - i) - 1);
                if (_nextSlot > 0)
                {
                    _elements[_elements.Length-1] = _elements[0];
                    Array.Copy(_elements, 1, _elements, 0, _nextSlot - 1);
                    _nextSlot--;
                }
                else
                {
                    _nextSlot = _elements.Length - 1;
                }

                _size--;
            }
        }

        public void RemoveAt(int index)
        {
            lock (_lock)
            {
                if (index < 0 || index >= _size)
                    throw new IndexOutOfRangeException("!(" + 0 + "<" + index + "<=" + _size + ")");

                int i = _nextE + index;
                if (i >= _elements.Length)
                    i -= _elements.Length;

                RemoveRealIndex(i);
            }
        }

        public bool Remove(T item)
        {
            lock (_lock)
            {
                int i = Array.IndexOf(_elements, item);
                if (i < 0)
                {
                    return false;
                }

                RemoveRealIndex(i);
                return true;
            }
        }

        #endregion

        // Iterator method.
        public IEnumerator GetEnumerator()
        {
            lock (_lock)
            {
                for (int i = 0; i < _size; i++)
                {
                    yield return GetUnsafe(i);
                }
            }
        }

        //#region IEnumerable<E> Members

        //public IEnumerator<T> GetEnumerator()
        //{
        //    throw new NotImplementedException();
        //}

        //#endregion

        //#region IEnumerable Members

        //IEnumerator System.Collections.IEnumerable.GetEnumerator()
        //{
        //    throw new NotImplementedException();
        //}

        //#endregion
    }
}


text:
#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010-2013 FUJIWARA, Yusuke
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
#endregion -- License Terms --

using System;

namespace MsgPack.Serialization
{
	/// <summary>
	///		Defines non-generic message pack serializer interface for byte array which contains a single object.
	/// </summary>
	[Obsolete( "Use MessagePackSerializer abstract class instead." )]
	public interface IMessagePackSingleObjectSerializer : IMessagePackSerializer
	{

		/// <summary>
		///		Serialize specified object to the array of <see cref="Byte"/>.
		/// </summary>
		/// <param name="objectTree">Object to be serialized.</param>
		/// <returns>An array of <see cref="Byte"/> which stores serialized value.</returns>
		/// <exception cref="System.Runtime.Serialization.SerializationException">
		///		Failed to serialize object.
		/// </exception>
		/// <exception cref="NotSupportedException">
		///		The type of <paramref name="objectTree"/> is not serializable even if it can be deserialized.
		/// </exception>
		/// <seealso cref="MessagePackSerializer.Capabilities"/>
		[System.Diagnostics.CodeAnalysis.SuppressMessage( "Microsoft.Naming", "CA1720:IdentifiersShouldNotContainTypeNames", MessageId = "object", Justification = "'objectTree' does not mean System.Object." )]
		byte[] PackSingleObject( object objectTree );

		/// <summary>
		///		Deserialize a single object from the array of <see cref="Byte"/> which contains a serialized object.
		/// </summary>
		/// <param name="buffer">An array of <see cref="Byte"/> serialized value to be stored.</param>
		/// <returns>The deserialized object.</returns>
		/// <exception cref="ArgumentNullException">
		///		<paramref name="buffer"/> is <c>null</c>.
		/// </exception>
		/// <exception cref="System.Runtime.Serialization.SerializationException">
		///		Failed to deserialize object.
		/// </exception>
		/// <exception cref="MessageTypeException">
		///		Failed to deserialize object due to invalid stream.
		/// </exception>
		/// <exception cref="InvalidMessagePackStreamException">
		///		Failed to deserialize object due to invalid stream.
		/// </exception>
		/// <exception cref="NotSupportedException">
		///		The type of deserializing is not serializable even if it can be serialized.
		/// </exception>
		/// <seealso cref="MessagePackSerializer.Capabilities"/>
		/// <remarks>
		///		<para>
		///			This method assumes that <paramref name="buffer"/> contains single serialized object dedicatedly,
		///			so this method does not return any information related to actual consumed bytes.
		///		</para>
		///		<para>
		///			This method is a counter part of <see cref="PackSingleObject"/>.
		///		</para>
		/// </remarks>
		object UnpackSingleObject( byte[] buffer );
	}
}

redpajama_set_name: RedPajamaGithub


text:
package io.werval.runtime.http;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import io.werval.api.http.QueryString;
import io.werval.util.MultiValueMapMultiValued;
import io.werval.util.TreeMultiValueMap;

import static io.werval.runtime.util.Comparators.LOWER_CASE;
import static java.util.Collections.emptyMap;

public class QueryStringInstance
    extends MultiValueMapMultiValued<String, String>
    implements QueryString, Serializable
{
    public static final QueryString EMPTY = new QueryStringInstance();

    public QueryStringInstance()
    {
        this( emptyMap() );
    }

    public QueryStringInstance( Map<String, List<String>> values )
    {
        this( values, DEFAULT_CONSTRAINT_EX_BUILDER );
    }

    public QueryStringInstance(
        Map<String, List<String>> values,
        Function<String, ? extends RuntimeException> constraintExBuilder
    )
    {
        super( new TreeMultiValueMap<>( LOWER_CASE ), constraintExBuilder );
        if( values != null )
        {
            values.entrySet().stream().forEach(
                val -> this.mvmap.put( val.getKey(), new ArrayList<>( val.getValue() ) )
            );
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Colors for Green Apple theme
  ~ Original color scheme by CarlosEsco, Jays2Kings and CrepeTF
  ~ M3 colors generated by Material Theme Builder (https://goo.gle/material-theme-builder-web)
  ~
  ~ Key colors:
  ~ Primary #188140
  ~ Secondary #188140
  ~ Tertiary #D33131
  ~ Neutral #5D5F5B
-->
<resources>
    <color name="greenapple_primary">#006D2F</color>
    <color name="greenapple_onPrimary">#FFFFFF</color>
    <color name="greenapple_primaryContainer">#96F8A9</color>
    <color name="greenapple_onPrimaryContainer">#002109</color>
    <color name="greenapple_secondary">#006D2F</color>
    <color name="greenapple_onSecondary">#FFFFFF</color>
    <color name="greenapple_secondaryContainer">#96F8A9</color>
    <color name="greenapple_onSecondaryContainer">#002109</color>
    <color name="greenapple_tertiary">#B91D22</color>
    <color name="greenapple_onTertiary">#FFFFFF</color>
    <color name="greenapple_tertiaryContainer">#FFDAD5</color>
    <color name="greenapple_onTertiaryContainer">#410003</color>
    <color name="greenapple_background">#FBFDF7</color>
    <color name="greenapple_onBackground">#1A1C19</color>
    <color name="greenapple_surface">#FBFDF7</color>
    <color name="greenapple_onSurface">#1A1C19</color>
    <color name="greenapple_surfaceVariant">#DDE5DA</color>
    <color name="greenapple_onSurfaceVariant">#414941</color>
    <color name="greenapple_outline">#717970</color>
    <color name="greenapple_inverseOnSurface">#F0F2EC</color>
    <color name="greenapple_inverseSurface">#2F312E</color>
    <color name="greenapple_primaryInverse">#7ADB8F</color>
</resources>


text:
//hierarchical clh lock
#ifndef _HCLH_H_
#define _HCLH_H_

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <numa.h>
#include <pthread.h>
#include "utils.h"
#include "atomic_ops.h"

typedef struct node_fields {
     volatile uint8_t successor_must_wait;
     volatile uint8_t tail_when_spliced;
     volatile uint8_t cluster_id;
} node_fields;

typedef struct qnode {
    union {
        volatile uint32_t data;
        node_fields fields;
#ifdef ADD_PADDING
        volatile uint8_t padding[CACHE_LINE_SIZE];
#endif
    };
} qnode;

typedef volatile qnode *qnode_ptr;
typedef qnode_ptr local_queue;
typedef qnode_ptr global_queue;

//global parameters needed to oerate with a lock
typedef struct hclh_global_params {
    global_queue* shared_queue;
    local_queue** local_queues;
    volatile uint32_t* init_done;
#ifdef ADD_PADDING
#if CACHE_LINE_SIZE == 16
#else
    volatile uint8_t padding[CACHE_LINE_SIZE-20];
#endif
#endif

} hclh_global_params;

//thread local parameters
typedef struct hclh_local_params {
    qnode* my_qnode;
    qnode* my_pred;
    local_queue* my_queue;
} hclh_local_params;

/*
 *  Methods aiding with array of locks manipulation
 */

hclh_global_params** init_hclh_array_global(uint32_t num_locks);

hclh_local_params** init_hclh_array_local(uint32_t thread_num, uint32_t num_locks, hclh_global_params** the_params);

void end_hclh_array_local(hclh_local_params** local_params, uint32_t size);

void end_hclh_array_global(hclh_global_params** global_params, uint32_t size);

//single lock manipluation
hclh_global_params* init_hclh_global();

hclh_local_params* init_hclh_local(uint32_t thread_num, hclh_global_params* the_params);

void end_hclh_local(hclh_local_params* local_params);

void end_hclh_global(hclh_global_params* global_params);

//lock
volatile qnode * hclh_acquire(local_queue *lq, global_queue *gq, qnode *my_qnode);

//unlock
qnode * hclh_release(qnode *my_qnode, qnode * my_pred, uint8_t th_cluster);

int is_free_hclh(local_queue *lq, global_queue *gq, qnode *my_qnode);

#endif


text:
Mapping test webpage, made 3/06 using Derek Eder's search template
Hope this works


text:
import clone from './utils/clone.js'
import colors from './utils/colors.js'
import copyToClipboard from './utils/copy-to-clipboard.js'
import createMetaMixin from './utils/create-meta-mixin.js'
import createUploaderComponent from './utils/create-uploader-component.js'
import date from './utils/date.js'
import debounce from './utils/debounce.js'
import dom from './utils/dom.js'
import event, { noop } from './utils/event.js'
import exportFile from './utils/export-file.js'
import extend from './utils/extend.js'
import format from './utils/format.js'
import frameDebounce from './utils/frame-debounce.js'
import getCssVar from './utils/get-css-var.js'
import morph from './utils/morph.js'
import openURL from './utils/open-url.js'
import patterns from './utils/patterns.js'
import scroll from './utils/scroll.js'
import setCssVar from './utils/set-css-var.js'
import throttle from './utils/throttle.js'
import uid from './utils/uid.js'

export {
  clone,
  colors,
  copyToClipboard,
  createMetaMixin,
  createUploaderComponent,
  date,
  debounce,
  dom,
  event,
  exportFile,
  extend,
  format,
  frameDebounce,
  getCssVar,
  noop,
  morph,
  openURL,
  patterns,
  scroll,
  setCssVar,
  throttle,
  uid
}


text:
using System.Net.Sockets;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Client.Notifications;

namespace Client.Views
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        public static MainWindow Instance { get; private set; }

        private const double TopOffset = 20;
        private const double LeftOffset = 380;
        private readonly GrowlNotifications _growlNotifications = new GrowlNotifications();

        public MainWindow()
        {
            InitializeComponent();

            _growlNotifications.Top = SystemParameters.WorkArea.Top + TopOffset;
            _growlNotifications.Left = SystemParameters.WorkArea.Left + SystemParameters.WorkArea.Width - LeftOffset;

            CreateTab("LOGIN", new Login());
            CreateTab("REGISTER", new Register());

            Instance = this;
        }

        public void ShowNotification(string title, string message)
        {
            var icon = Geometry.Parse("F1 M 38,19C 48.4934,19 57,27.5066 57,38C 57,48.4934 48.4934,57 38,57C 27.5066,57 19,48.4934 19,38C 19,27.5066 27.5066,19 38,19 Z M 51,30L 42,30L 45.0857,33.0858L 39.5754,38.5962L 34.5,33.5208L 24,44.0208L 26.8284,46.8493L 34.5,39.1777L 39.5754,44.2531L 47.9142,35.9142L 51,39L 51,30 Z");
            _growlNotifications.AddNotification(new Notification { Title = title, IconData = icon, Message = message, MessageType = title });
        }

        public void ShowChartTab()
        {
            RemoveTab("CHARTS");
            TabablzControl.SelectedItem = CreateTab("CHARTS", new DiginoteChart());
        }

        public void AfterLogin()
        {
            CreateTab("INFO", new Info());
            CreateTab("BUY", new Buy());
            CreateTab("SELL", new Sell());
            CreateTab("TRANSACTIONS", new Transactions());
            RemoveTab("LOGIN");
            RemoveTab("REGISTER");
            TabablzControl.SelectedIndex = 0;
        }

        public void AfterLogout()
        {
            CreateTab("LOGIN", new Login());
            CreateTab("REGISTER", new Register());
            RemoveTab("INFO");
            RemoveTab("BUY");
            RemoveTab("SELL");
            RemoveTab("CHARTS");
            RemoveTab("TRANSACTIONS");
            TabablzControl.SelectedIndex = 0;
        }

        private TabItem CreateTab(string header, FrameworkElement control)
        {
            /* <TabItem Header="REGISTER">
                <views:Register Margin="8" />
               </TabItem> */

            control.Margin = new Thickness(8);
            var tabItem = new TabItem { Header = header, Content = control };

            TabablzControl.Items.Add(tabItem);
            return tabItem;
        }

        private void RemoveTab(string header)
        {
            for (var i = 0; i < TabablzControl.Items.Count; i++)
            {
                var item = TabablzControl.Items[i];
                var tabItem = item as TabItem;
                if (tabItem == null)
                    continue;

                if ((string) tabItem.Header != header)
                    continue;

                TabablzControl.Items.RemoveAt(i);
                return;
            }
        }

        protected override void OnClosed(System.EventArgs e)
        {
            var session = App.Current.Session;
            _growlNotifications.Close();
            try
            {
                App.Current.TheDigiMarket.Logout(session.Username, session.Password);
            }
            catch (SocketException ex)
            {
                // shhhhhhh
            }
            base.OnClosed(e);
        }
    }
}


text:
dotMailer [![Build Status](https://travis-ci.org/econsultancy/dotmailer.png?branch=master)](https://travis-ci.org/econsultancy/dotmailer) [![Gem Version](https://badge.fury.io/rb/dotmailer.png)](http://badge.fury.io/rb/dotmailer)
=========

[dotMailer](http://www.dotmailer.co.uk/) provide both a REST and SOAP API for interacting with their system. The REST API supports both XML and JSON payloads.

This gem provides a Ruby wrapper allowing you to access the REST API, and uses JSON payloads.

For a full description of the API, see https://api.dotmailer.com

Installation
------------

To install as a standalone gem:

    gem install dotmailer

To install as part of a project managed by bundler, add to your Gemfile:

    gem 'dotmailer'

Usage
-----

Interaction with the dotMailer API is done via a `DotMailer::Account` object, which is initialized with an API username and password:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

All interaction via this object will be for the dotMailer account associated with the API credentials.

For instructions on how to obtain your API username and password, see [here](http://www.dotmailer.co.uk/api/more_about_api/getting_started_with_the_api.aspx).

Data Fields
-----------

### List

`DotMailer::Account#data_fields` will return an Array of `DotMailer::DataField` objects representing the data fields for the account's global address book:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    account.data_fields
    => [
         DotMailer::DataField name: "FIELD1", type: "String", visibility: "Public", default: "",
         DotMailer::DataField name: "FIELD2", type: "Numeric", visibility: "Private", default: 0
       ]

NOTE: The returned data fields are cached in memory for `DotMailer::Account::CACHE_LIFETIME` seconds to avoid unnecessarily hitting the API.

### Create

`DotMailer::Account#create_data_field` will attempt to create a new data field. On failure it raises an exception:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    account.create_data_field 'FIELD3', :type => 'String'

    account.create_data_field 'FIELD3', :type => 'String'
    => DotMailer::InvalidRequest: Field already exists. ERROR_NON_UNIQUE_DATAFIELD

NOTE: successfully creating a data field via this method will invalidate any cached data fields.

Contacts
--------

### Finding A Contact

There are two ways to find contacts via the API, using a contact's email address or id.

The gem provides two methods for doing so: `DotMailer::Account#find_contact_by_email` and `DotMailer::Account#find_contact_by_id`.

Suppose you have one contact with email john@example.com and id 12345, then:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    account.find_contact_by_email 'john@example.com'
    => DotMailer::Contact id: 12345, email: john@example.com

    account.find_contact_by_email 'sue@example.com'
    => nil

    account.find_contact_by_id 12345
    => DotMailer::Contact id: 12345, email: john@example.com

    account.find_contact_by_id 54321
    => nil

### Finding contacts modified since a particular time

Contacts modified since a particular time can be retrieved by passing a Time object to `DotMailer::Account#find_contacts_modified_since`:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    time = Time.parse('1st March 2013 15:30')

    account.find_contacts_modified_since(time)
    => [
         DotMailer::Contact id: 123, email: bob@example.com,
         DotMailer::Contact id: 345, email: sue@example.com
       ]

### Updating a contact

Contacts can be updated by assigning new values and calling `DotMailer::Contact#save`:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    contact = account.find_contact_by_email 'john@example.com'
    => DotMailer::Contact id: 12345, email: john@example.com, email_type: Html

    contact.email_type
    => 'Html'
    contact.email_type = 'PlainText'
    => 'PlainText

    contact.save

    contact = DotMailer.find_contact_by_email 'john@example.com'
    => DotMailer::Contact id: 12345, email: john@example.com, email_type: PlainText

### Resubscribing a contact

The dotMailer API provides a specific endpoint for resubscribing contacts which will initiate the resubscribe process via email, then redirect the contact to a specified URL.

This can be accessed through the `DotMailer::Contact#resubscribe` method:

    contact = DotMailer.find_contact_by_email 'john@example.com'
    => DotMailer::Contact id: 12345, email: john@example.com, status: Unsubscribed

    contact.subscribed?
    => false
    contact.resubscribe 'http://www.example.com/resubscribed'

Then, once the contact has gone through the resubscribe process and been redirected to the specified URL:

    contact = DotMailer.find_contact_by_email 'john@example.com'
    => DotMailer::Contact id: 12345, email: john@example.com, status: Subscribed

    contact.subscribed?
    => true

### Deleting a contact

Contacts can be deleted by calling `DotMailer::Contact#delete`:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    contact = account.find_contact_by_email 'john@example.com'
    => DotMailer::Contact id: 12345, email: john@example.com, email_type: Html

    contact.delete

### Bulk Import

`DotMailer::Account#import_contacts` will start a batch import of contacts into the global address book, and return a `DotMailer::ContactImport` object which has a `status`:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    contacts = [
      { 'Email' => 'joe@example.com' },
      { 'Email' => 'sue@example.com' },
      { 'Email' => 'bob@example.com' },
      { 'Email' => 'invalid@email'   }
    ]

    import = account.import_contacts contacts
    => DotMailer::ContactImport contacts: [{"Email"=>"joe@example.com" }, {"Email"=>"sue@example.com" }, {"Email"=>"bob@example.com"}]

    import.finished?
    => false
    import.status
    => "NotFinished"

The call can also block for you and will wait until the import is finished :

    import = account.import_contacts contacts, wait_for_finish: true

    # it will block here until finished is true
    # if the import takes longer than 385 seconds then it will raise `DotMailer::ImportNotFinished`

    import.finished?
    => true

Then, once the import has finished, you can query the status and get any errors (as a CSV::Table object):

    import.finished?
    => true
    import.status
    => "Finished"

    errors = import.errors
    => #<CSV::Table>
    errors.count
    => 1
    errors.first
    => #<CSV::Row "Reason":"Invalid Email" "Email":"invalid@email">

**NOTE** The specified contacts can only have the following keys (case insensitive):

* `id`
* `email`
* `optInType`
* `emailType`
* Any data field name for the account (i.e. any value in `account.data_fields.map(&:name)`)

If any other key is present in any of the contacts, a `DotMailer::UnknownDataField` error will be raised

Suppressions
------------

The dotMailer API provides an endpoint for retrieving suppressions since a particular point in time, where a "suppression" is the combination of a contact, a removal date, and a reason for the suppression.

To fetch these suppressions, pass a Time object to `DotMailer::Account#find_suppressions_since`:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    time = Time.parse('1st March 2013 15:30')

    suppressions = account.find_suppressions_since(time)
    => [
         DotMailer::Suppression reason: Unsubscribed, date_removed: 2013-03-02 14:00:00 UTC,
         DotMailer::Suppression reason: Unsubscribed, date_removed: 2013-03-04 16:00:00 UTC
       ]

    suppressions.first.contact
    => DotMailer::Contact id: 12345, email: john@example.com

Campaigns
---------

### From addresses

Campaigns can only be sent with a from address which has been set up in dotMailer (see [here](https://support.dotmailer.com/entries/20653397-How-do-I-create-a-custom-from-address-or-additional-alias-)).

To access this list of from addresses, call `DotMailer::Account#from_addresses`:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    account.from_addresses
    => [
         DotMailer::FromAddress id: 123 email: info@example.com,
         DotMailer::FromAddress id: 456 email: no-reply@example.com
       ]

### Creating Campaigns

To create a dotMailer campaign, call `DotMailer::Account#create_campaign` with a hash containing the following required keys:

* `:name`               - The name of the campaign as it will appear in the web interface
* `:subject`            - The subject to use when sending the campaign
* `:from_name`          - The name which will appear in the "From" header of the sent campaign
* `:from_email`         - The email which will appear in the "From" header of the sent campaign (this must be a valid from address in the dotMailer system, see "From addresses" above)
* `:html_content`       - The content which will be included in the HTML part of the sent campaign
* `:plain_text_content` - The content which will be included in the Plain Text part of the sent campaign

For example:

    account = DotMailer::Account.new('your-api-username', 'your-api-password')

    campaign = account.create_campaign(
      :name                => 'my_campaign',
      :subject             => 'My Campaign',
      :from_name           => 'Me',
      :from_email          => 'me@example.com',
      :html_content        => '
Hello!
Unsubscribe',
      :plain_text_content  => "Hello!\n======\nhttp://$UNSUB$"
    )
    => DotMailer::Campaign id: 123, name: my_campaign

    campaign.subject
    => "My Campaign"

    campaign.from_address
    => DotMailer::FromAddress id: 345, email: 'me@example.com'

## License

Copyright (c) 2013 Econsultancy. Distributed under the MIT License. See LICENSE.txt for further details.


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Data Checksums</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Base64-Encoding.html" title="Base64 Encoding">
<link rel="next" href="glib-Data-HMACs.html" title="Secure HMAC Digests">
<meta name="generator" content="GTK-Doc V1.18 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">

GLib Reference Manual

Top
                   |
                  Description

Data Checksums

Data Checksums — computes the checksum for data

Synopsis

#include <glib.h>

enum                GChecksumType;
gssize              g_checksum_type_get_length          (GChecksumType checksum_type);
                    GChecksum;
GChecksum *         g_checksum_new                      (GChecksumType checksum_type);
GChecksum *         g_checksum_copy                     (const GChecksum *checksum);
void                g_checksum_free                     (GChecksum *checksum);
void                g_checksum_reset                    (GChecksum *checksum);
void                g_checksum_update                   (GChecksum *checksum,
                                                         const guchar *data,
                                                         gssize length);
const gchar *       g_checksum_get_string               (GChecksum *checksum);
void                g_checksum_get_digest               (GChecksum *checksum,
                                                         guint8 *buffer,
                                                         gsize *digest_len);

gchar *             g_compute_checksum_for_data         (GChecksumType checksum_type,
                                                         const guchar *data,
                                                         gsize length);
gchar *             g_compute_checksum_for_string       (GChecksumType checksum_type,
                                                         const gchar *str,
                                                         gssize length);
gchar *             g_compute_checksum_for_bytes        (GChecksumType checksum_type,
                                                         GBytes *data);

Description

GLib provides a generic API for computing checksums (or "digests")
for a sequence of arbitrary bytes, using various hashing algorithms
like MD5, SHA-1 and SHA-256. Checksums are commonly used in various
environments and specifications.

GLib supports incremental checksums using the GChecksum data
structure, by calling g_checksum_update() as long as there's data
available and then using g_checksum_get_string() or
g_checksum_get_digest() to compute the checksum and return it either
as a string in hexadecimal form, or as a raw sequence of bytes. To
compute the checksum for binary blobs and NUL-terminated strings in
one go, use the convenience functions g_compute_checksum_for_data()
and g_compute_checksum_for_string(), respectively.

Support for checksums has been added in GLib 2.16

Details

enum GChecksumType

typedef enum {
  G_CHECKSUM_MD5,
  G_CHECKSUM_SHA1,
  G_CHECKSUM_SHA256
} GChecksumType;

The hashing algorithm to be used by GChecksum when performing the
digest of some data.

Note that the GChecksumType enumeration may be extended at a later
date to include new hashing algorithm types.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

G_CHECKSUM_MD5

Use the MD5 hashing algorithm

G_CHECKSUM_SHA1

Use the SHA-1 hashing algorithm

G_CHECKSUM_SHA256

Use the SHA-256 hashing algorithm

Since 2.16

g_checksum_type_get_length ()

gssize              g_checksum_type_get_length          (GChecksumType checksum_type);

Gets the length in bytes of digests of type checksum_type

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum_type :

a GChecksumType

Returns :

the checksum length, or -1 if checksum_type is
not supported.

Since 2.16

GChecksum

typedef struct _GChecksum GChecksum;

An opaque structure representing a checksumming operation.
To create a new GChecksum, use g_checksum_new(). To free
a GChecksum, use g_checksum_free().

Since 2.16

g_checksum_new ()

GChecksum *         g_checksum_new                      (GChecksumType checksum_type);

Creates a new GChecksum, using the checksum algorithm checksum_type.
If the checksum_type is not known, NULL is returned.
A GChecksum can be used to compute the checksum, or digest, of an
arbitrary binary blob, using different hashing algorithms.

A GChecksum works by feeding a binary blob through g_checksum_update()
until there is data to be checked; the digest can then be extracted
using g_checksum_get_string(), which will return the checksum as a
hexadecimal string; or g_checksum_get_digest(), which will return a
vector of raw bytes. Once either g_checksum_get_string() or
g_checksum_get_digest() have been called on a GChecksum, the checksum
will be closed and it won't be possible to call g_checksum_update()
on it anymore.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum_type :

the desired type of checksum

Returns :

the newly created GChecksum, or NULL.
Use g_checksum_free() to free the memory allocated by it.

Since 2.16

g_checksum_copy ()

GChecksum *         g_checksum_copy                     (const GChecksum *checksum);

Copies a GChecksum. If checksum has been closed, by calling
g_checksum_get_string() or g_checksum_get_digest(), the copied
checksum will be closed as well.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum :

the GChecksum to copy

Returns :

the copy of the passed GChecksum. Use g_checksum_free()
when finished using it.

Since 2.16

g_checksum_free ()

void                g_checksum_free                     (GChecksum *checksum);

Frees the memory allocated for checksum.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum :

a GChecksum

Since 2.16

g_checksum_reset ()

void                g_checksum_reset                    (GChecksum *checksum);

Resets the state of the checksum back to its initial state.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum :

the GChecksum to reset

Since 2.18

g_checksum_update ()

void                g_checksum_update                   (GChecksum *checksum,
                                                         const guchar *data,
                                                         gssize length);

Feeds data into an existing GChecksum. The checksum must still be
open, that is g_checksum_get_string() or g_checksum_get_digest() must
not have been called on checksum.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum :

a GChecksum

data :

buffer used to compute the checksum

length :

size of the buffer, or -1 if it is a null-terminated string.

Since 2.16

g_checksum_get_string ()

const gchar *       g_checksum_get_string               (GChecksum *checksum);

Gets the digest as an hexadecimal string.

Once this function has been called the GChecksum can no longer be
updated with g_checksum_update().

The hexadecimal characters will be lower case.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum :

a GChecksum

Returns :

the hexadecimal representation of the checksum. The
returned string is owned by the checksum and should not be modified
or freed.

Since 2.16

g_checksum_get_digest ()

void                g_checksum_get_digest               (GChecksum *checksum,
                                                         guint8 *buffer,
                                                         gsize *digest_len);

Gets the digest from checksum as a raw binary vector and places it
into buffer. The size of the digest depends on the type of checksum.

Once this function has been called, the GChecksum is closed and can
no longer be updated with g_checksum_update().

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum :

a GChecksum

buffer :

output buffer

digest_len :

an inout parameter. The caller initializes it to the size of buffer.
After the call it contains the length of the digest.

Since 2.16

g_compute_checksum_for_data ()

gchar *             g_compute_checksum_for_data         (GChecksumType checksum_type,
                                                         const guchar *data,
                                                         gsize length);

Computes the checksum for a binary data of length. This is a
convenience wrapper for g_checksum_new(), g_checksum_get_string()
and g_checksum_free().

The hexadecimal string returned will be in lower case.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum_type :

a GChecksumType

data :

binary blob to compute the digest of

length :

length of data

Returns :

the digest of the binary data as a string in hexadecimal.
The returned string should be freed with g_free() when done using it.

Since 2.16

g_compute_checksum_for_string ()

gchar *             g_compute_checksum_for_string       (GChecksumType checksum_type,
                                                         const gchar *str,
                                                         gssize length);

Computes the checksum of a string.

The hexadecimal string returned will be in lower case.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum_type :

a GChecksumType

str :

the string to compute the checksum of

length :

the length of the string, or -1 if the string is null-terminated.

Returns :

the checksum as a hexadecimal string. The returned string
should be freed with g_free() when done using it.

Since 2.16

g_compute_checksum_for_bytes ()

gchar *             g_compute_checksum_for_bytes        (GChecksumType checksum_type,
                                                         GBytes *data);

Computes the checksum for a binary data. This is a
convenience wrapper for g_checksum_new(), g_checksum_get_string()
and g_checksum_free().

The hexadecimal string returned will be in lower case.

<colgroup>
<col align="left" valign="top">
<col>
</colgroup>

checksum_type :

a GChecksumType

data :

binary blob to compute the digest of

Returns :

the digest of the binary data as a string in hexadecimal.
The returned string should be freed with g_free() when done using it.

Since 2.34

          Generated by GTK-Doc V1.18


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2021 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<resources>
    <!--
    Having clipToOutline to true is needed for the background (that has id with
    android:id/background so that the system knows the widget has been updated
    and doesn't need to be clipped by the launcher.
    -->
    <style name="Widget.AppWidget.AppWidget.Container" parent="android:Widget">
        <item name="android:id">@android:id/background</item>
        <item name="android:padding">?attr/appWidgetPadding</item>
        <item name="android:background">@drawable/app_widget_background</item>
        <item name="android:clipToOutline">true</item>
    </style>

    <!--
    Having clipToOutline to true for the inner view makes sure the content of the view
    is clipped.
    -->
    <style name="Widget.AppWidget.AppWidget.InnerView" parent="android:Widget">
        <item name="android:padding">?attr/appWidgetPadding</item>
        <item name="android:background">@drawable/app_widget_inner_view_background</item>
        <item name="android:clipToOutline">true</item>
    </style>
</resources>


text:
import React, { Component, PropTypes } from 'react'
import classNames from 'classnames'
import Header from '../Header'
import Footer from '../Footer'
import styles from './app.scss'

export default class App extends Component {
    static propTypes = {
        children: PropTypes.object.isRequired
    };

    render () {
        const containerClasses = classNames(styles.content, 'app-container')

        return (

                        {this.props.children}

        )
    }
}


text:
require 'fog/compute/models/server'

module Fog
  module Compute
    class StormOnDemand

      class Server < Fog::Compute::Server
        identity :uniq_id

        attribute :accnt
        attribute :active
        attribute :backup_enabled
        attribute :backup_plan
        attribute :backup_quota
        attribute :backup_size
        attribute :bandwidth_quota
        attribute :config_description
        attribute :config_id
        attribute :create_date
        attribute :domain
        attribute :ip
        attribute :ip_count
        attribute :manage_level
        attribute :template
        attribute :template_description
        attribute :type
        attribute :zone

        attr_writer :password

        def initialize(attributes={})
          super
        end

        def destroy
          requires :identity
          service.delete_server(:uniq_id => identity)
          true
        end

        def ready?
          active == 1
        end

        def reboot(options={})
          requires :identity
          service.reboot_server({:uniq_id => identity}.merge!(options))
          true
        end

        def clone(options)
          requires :identity
          service.clone_server({:uniq_id => identity}.merge!(options))
          true
        end

        def resize(options)
          requires :identity
          service.resize_server({:uniq_id => identity}.merge!(options))
          true
        end

        def history(options={})
          requires :identity
          params = {:uniq_id => identity}.merge!(options)
          res = service.server_history(params).body
          res['items']
        end

        def shutdown(options={})
          requires :identity
          service.shutdown_server({:uniq_id => identity}.merge!(options)).body
        end

        def start
          reqwuires :identity
          service.start_server({:uniq_id => identity}).body
        end

        def status
          requires :identity
          service.server_status({:uniq_id => identity}).body
        end

        def update(options)
          requires :identity
          service.update_server({:uniq_id => identity}.merge!(options)).body
        end

      end

    end
  end
end


text:
<?php

// autoload_namespaces.php @generated by Composer

$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);

return array(
    'Twig_' => array($vendorDir . '/twig/twig/lib'),
    'Pimple' => array($vendorDir . '/pimple/pimple/src'),
    'Doctrine\\DBAL\\' => array($vendorDir . '/doctrine/dbal/lib'),
    'Doctrine\\Common\\Lexer\\' => array($vendorDir . '/doctrine/lexer/lib'),
    'Doctrine\\Common\\Inflector\\' => array($vendorDir . '/doctrine/inflector/lib'),
    'Doctrine\\Common\\Collections\\' => array($vendorDir . '/doctrine/collections/lib'),
    '' => array($baseDir . '/src'),
);


text:
module Doh

def self.class_basename(klass)
  full_name = klass.to_s
  retval = full_name.rpartition('::').last
  retval = full_name if retval.empty?
  retval
end

end


text:
package org.apache.isis.applib.services.i18n;

import java.util.List;
import org.apache.isis.applib.annotation.Programmatic;

public interface TranslationsResolver {

    @Programmatic
    public List<String> readLines(final String file);

}


text:
#include <aws/cognito-idp/model/AssociateSoftwareTokenResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/UnreferencedParam.h>

#include <utility>

using namespace Aws::CognitoIdentityProvider::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;

AssociateSoftwareTokenResult::AssociateSoftwareTokenResult()
{
}

AssociateSoftwareTokenResult::AssociateSoftwareTokenResult(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
  *this = result;
}

AssociateSoftwareTokenResult& AssociateSoftwareTokenResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result)
{
  JsonView jsonValue = result.GetPayload().View();
  if(jsonValue.ValueExists("SecretCode"))
  {
    m_secretCode = jsonValue.GetString("SecretCode");

  }

  if(jsonValue.ValueExists("Session"))
  {
    m_session = jsonValue.GetString("Session");

  }

  return *this;
}


text:
package rise.http;

import rise.Poll;
import rise.db.DbIterator;
import rise.util.Convert;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONStreamAware;

import javax.servlet.http.HttpServletRequest;

public final class GetPollIds extends APIServlet.APIRequestHandler {

    static final GetPollIds instance = new GetPollIds();

    private GetPollIds() {
        super(new APITag[] {APITag.VS}, "firstIndex", "lastIndex");
    }

    @Override
    JSONStreamAware processRequest(HttpServletRequest req) {

        int firstIndex = ParameterParser.getFirstIndex(req);
        int lastIndex = ParameterParser.getLastIndex(req);

        JSONArray pollIds = new JSONArray();
        try (DbIterator<Poll> polls = Poll.getAllPolls(firstIndex, lastIndex)) {
            while (polls.hasNext()) {
                pollIds.add(Convert.toUnsignedLong(polls.next().getId()));
            }
        }
        JSONObject response = new JSONObject();
        response.put("pollIds", pollIds);
        return response;

    }

}


text:
require 'socket' # Socket.gethostname

# = Cabar
#
# Cabar is an extensible software component backplane for
# managing software components.
# It can be used with Ruby or other software technologies.
#
# == Licensing
#
# See LICENSE.txt
#
# == Features
#
# * Extensibility:
# Component Facets can be declared in components to glue components
# back together.  Components can add plug-ins to Cabar.  Plugins can
# add facets, commands or observe the internals of Cabar.
#
# * Configurability:
# User configuration can be used to override configurations
# in the components.
#
# * Component Versioning:
# Component versions can be specified and checked for conflicts.
#
# * Component Repository Overlays:
# Component repositories are searched in a specific order.
# For example, a development repository can override a specific
# component version for testing.
#
# == Credits
#
# Cabar was created by Kurt Stephens at CashNetUsa.com.
#
# == Concepts
#
# In a large software system, it becomes important to consider
# refactoring it into smaller, testable and deployable parts --
# smaller parts are easier to debug, test, understand and reuse.
#
# Refactoring a large system requires determining how parts
# are interrelated so that they can be torn apart and reconnected
# via APIs, protocols and contracts.
#
# The breaking apart of components requires the introduction of
# how components will reassembled and communicate between each other.
# This is typically referred to "glue".
#
# The nature of the recomposition and communication between components
# may not be realized until many components are "cleaved" off
# from a large system.  This is because large systems have
# unique issues when dealing with configuration, testing,
# deployment, etc.  Thus any software backplane should be
# open-ended for extension.
#
# Imagine a large software system as a multi-dimentional "blob".
# If a component can be "sliced" off of a software "blob",
# the axis of slicing leaves a unique surface, or Facet, between
# the component and the remaining software system.
#
# To reconnect to the original
# system or to reuse the new component requires that communication
# that may have been implicit between tightly integrated code,
# needs to be made explicit between the new component and its consumers.
#
# == Example
#
# An application named "boc" (Blob Of Code)
# contains a "configuration" class
# that reads configuration from files and provides
# configuration information to the rest of BOC.
#
# BOC has a single directory where all the configuration files are located,
# this directory is hard-coded in the configuration class.
#
# We are creating a new application in which we want to reuse the
# "configuration" class from the "boc" application.
#
# If the "configuration" class is "sliced" off from "boc"
# into a separate component,
# the new configuration component will need to know where all
# the configuration files live.
#
# More importantly, if the "configuration" component is going
# to be reused by other components, it will need to know
# where those components' configuration files are located.
#
# === Slicing into Components and Facets
#
# A Facet is created by "slicing" off the "configuration" component.
# This could be a configuration directory search path.  Each component using
# the "configuration" component would communicate a configuration
# file directory to the "configuration search path."
#
# Below "boc" is represented as a blob:
#
#        --------
#    ---/        \   ----
#   (             \ /    |
#  /               -     |
#  |                     |
#  |         boc         |
#  \                     |
#   -         --         |
#    (      _/  \       /
#     \    /     -------
#      ---/
#
#
# A configuration component is isolated and sliced
# from "boc":
#
#
#        --------
#    ---/        \   -----
#   (             \ /     |
#  /              /-      |
#  |             //       |
#  |    boc     //   ???  |
#  \           //         |
#   -         --          |
#    (      _/  \        /
#     \    /     --------
#      ---/
#
# After slicing of "boc_config" from "boc",
# two Components and a Facet are created:
#
# * A reusable component "boc_config",
# * A top-level component "boc", containing the rest of the application,
# * A facet named "boc_config_path", which is used to communicate
# the location of the configuration files for the "boc_config" component.
#
#
#                    boc_config_path Facet
#        --------       |
#    ---/        \     _|_     -----
#   (             \    /    _/     |
#  /             //   /   //       |
#  |            //   /   //        |
#  |    boc    //   /   //         |
#  \          //   /   //          |
#   -         /       -            |
#    (      _/        \ boc_config /
#     \    /           ------------
#      ---/
#
#
# At this point "boc_config" configuration component class must be
# changed -- the hard-coded
# path to the configuration file directory
# is replaced with a reference to an
# environment variable: BOC_CONFIG_PATH.
#
# === Facet Communication
#
# Cabar uses environment variables as a de-facto communication
# mechanism between components.  Environment variables were chosen
# for their flexiblity and ubiquity.  Most components already use
# environment variables for configuration: Ruby uses RUBYLIB and Perl
# uses PERL5LIB to specify where they can load modules from.  Similarly
# the PATH environment variable specifies where programs can be located
# by command shells and other programs.
#
# However, there is no reason that Facets cannot be designed to
# communicate through other means, such as:
#
# * a global configuration file.
# * shared memory.
# * direct messaging between classes.
# * configuration database.
#
# === Component Specification
#
# Next, the component specifications must be
# created.  Cabar uses a simple YAML document format
# for component specification.
#
# Cabar expects each component to reside in a component repository.
# A component repository is simply a directory containing subdirectories
# that have "cabar.yml" files, searched by "*/cabar.yml" and "*/*/cabar.yml"
# in each component repository directory.
#
# Component repositories are specified by the CABAR_PATH environment
# variable.
#
# Each component has its own directory structure with
# a "cabar.yml" file:
#
#   repo/
#
#     boc/
#       cabar.yml
#       bin/
#         boc
#       lib/ruby/
#         boc1.rb
#         boc2.rb
#       conf/
#         *.yml
#
#     boc_config/
#       cabar.yml
#       cabar.rb
#       lib/ruby/
#         boc_config.rb
#
# === The boc_config Component
#
# repo/boc_config/cabar.yml:
#
#   ---
#   cabar:
#     version: v1.0
#     component:
#       name: boc_config
#     plugin: cabar.rb
#     facet:
#       lib/ruby: true
#     requires:
#       component:
#         ruby: true
#
#
# "boc_config" has a cabar plugin, which defines the
# "boc_config_path" facet and the actual Ruby code
# of the component: lib/ruby/boc_config.rb.
#
# === The boc_config_path Facet
#
# repo/boc_config/cabar.rb:
#
#   Cabar::Plugin.new do
#     facet :boc_config_path,
#       :env_var => :BOC_CONFIG_PATH,
#       :std_path => 'conf'
#   end
#
# The 'boc_config_path' Facet will use 'conf' as the default
# directory.  The Facet will collect all the configuration directories
# of the components using the 'boc_config_path' facet into
# the BOC_CONFIG_PATH environment variable.
#
# === The boc Component
#
# repo/boc/cabar.yml:
#
#   ---
#   cabar:
#     version: v1.0
#     component:
#       name: boc
#     facet:
#       bin: true
#       lib/ruby: true
#       boc_config_path: true
#     requires:
#       component:
#         boc_config: true
#         ruby: true
#
# This specifies "boc" as a component that
# has a "bin" directory with programs and
# a configuration file directory named 'conf',
# by default to be used by the "boc_config"
# component to locate "boc" configuration files.
#
# === The cbr Command
#
# To get a list of commands availale in cbr, run:
#
#   > cbr help
#   > cbr help --verbose
#
# The output of most cbr commands is a YAML document, which makes
# programmatic parsing of output easier.
#
# The "cbr" command can set up the environment to
# tie "boc" and "boc_config" components together:
#
#   > export PATH=cabar/bin:$PATH
#   > cd repo && cbr env - boc
#   ...
#   PATH="repo/boc/bin:..."; export PATH;
#   BOC_CONFIG_PATH="repo/boc/conf:..."; export BOC_CONFIG_PATH;
#
# In the command line above: "- boc" means require "boc" as a top-level
# component.
#
# == Visualization of Components
#
# "cbr comp dot" generates component dependency graphs in the Dot
# lanugage for rendering with
# the Graphviz ( http://www.graphvis.org/ ) graph visualization toolkit.
#
# Graphs generated from the example directory are here: http://cabar.rubyforge.org/example/doc
#
# See example/Rakefile for examples on generating component graphs using cbr.
#
# == Specifying component name and version
#
# A component's name and versions are specified in two ways:
#
# * Explicitly in the component's cabar.yml file.
# * Implicitly as part of the component's directory name.
#
# If the component's name or version is not specified in its cabar.yml file it can be inferred from matching:
#
# * <<name>>/<<version>>/cabar.yml
# * <<name>>-<<version>>/cabar.yml
# * <<name>>/cabar.yml
#
# Cabar version strings follow the Debian version naming standard; see Cabar::Version for more details.
#
# == Requiring components
#
# To use a component in a environment, it must be "required" by the following mtethods, in order of precedence:
#
# * "- <<component-constraint>>" cbr command line option.
# * CABAR_REQUIRE environment variable.
# * require: component: section in a cabar_conf.yml file.
#
# The "- <<component-constraint>>" command line option forces cbr to require
# a top-level component.  This option can occur anywhere before the end of the
# cbr command path.  This overrides any component requires specified in a cabar_conf.yml file or the CABAR_TOP_LEVEL environment variable.
#
# For example:
#
#    > cbr comp dep
#
# Will show the default top-level component's dependencies.
#
#    > cbr comp dep - rubygems
#
# Will show only the "rubygems" component's dependencies.
#
# == Selecting components
#
# Cabar will find all available components residing in the component repositories specified in CABAR_PATH.  Component with the same name and version earlier in the CABAR_PATH are selected first, others are ignored.
#
# The set of available component versions is reduced by "selecting" versions based on constraints, in order of precedence:
#
# * "-S <<component-constraint>>" cbr command line option. (NOT IMPLEMENTED)
# * CABAR_SELECT environment variable.  (NOT IMPLEMENTED)
# * select: component: section in a cabar_conf.yml file.
#
# == Component Resolution
#
# Resolution of component version occurs in 3 phases.
#
# * Determine all available components.
# * Reducing the available component set into selected components by
# explicit selection, requiring or component interdependency.
# * Selecting the latest version of a component, if the remaining selected
# component versions is not singular.
#
# == Component Constraints
#
# Component constraints can be specified using the following patterns:
#
# * "name" - any version of a component named "name".
# * "name* - any version of a component with a name starting with "name".
# * "name/1.2" - The 1.2 version of component "name".
# * "name/>1.2" - Any version of component "name" greater than ">1.2".
#
# Unless a component has a dependency on a specific version, e.g.: because of
# required API or feature set, component dependencies are usually unversioned
# or at most, version limits.
#
# It's recommended that dependency constraints listed in
# components should be as open as possible,
# to allow component versions to be varied at the system configuration level,
# usually in a CABAR_CONFIG file or with the CABAR_SELECT environment variable.
#
# == Component Plug-ins
#
# List of available plugins:
#
#    > cbr plugin list
#
# == Rubygems Plug-in
#
# The rubygems plugin component, located under cabar/comp supports
# the collection of rubygems into a cabar component.  This is useful
# for creating software "platforms" for multiple systems.  For example
# one might create two "Ruby on Rails" software platforms to test
# different versions of rails and other dependencies.
#
# The 'rubygems'
# facet composes GEM_PATH directories for components with
# the 'rubygems' facet.  By default, the 'rubygems' facet expects gems to
# installed in a 'gems' subdirectory under the component directory.
#
# == Creating rubygems component
#
# Example: Create a directory named "platform_gems" somewhere under a
# CABAR_PATH repository.
#
# Create repo/platform_gems/cabar.yml:
#
#   cabar:
#     version: '1.0'
#     component:
#       name: platform_gems
#       version: '1.0'
#       description: 'Local gems repository'
#     provides:
#       rubygems: true
#     requires:
#       component:
#         rubygems: true
#
# == Installing gems into a rubygems platform component
#
#    > export CABAR_PATH=repo
#    > cbr - platform_gems gems gem install rails
#    > cbr - platform_gems gems gem list
#
# == Requiring a rubygems platform component
#
# TODO
#
# == Renderers
#
# TODO
#
# == Facet Design
#
# TODO
module Cabar
  # The Cabar version.
  def self.version
    Version.create '1.0'
  end

  # The directory containing Cabar itself.
  def self.cabar_base_directory
    @@cabar_base_directory ||=
      File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
  end

end

# Use to add comp/... directories to search path when its too early for
# cabar to require itself.
def cabar_comp_require name, version = nil
  path = File.expand_path(Cabar.cabar_base_directory + "/comp/#{name}/#{version}/lib/ruby")
  $:.insert(0, path) unless $:.include?(path)
  # $stderr.puts "#{$:.inspect} #{path.inspect}"
  require name
end

cabar_comp_require 'cabar_core'


text:
using System;
using System.Diagnostics;
using System.Threading.Tasks;
using Windows.Graphics.Imaging;
using Windows.Storage;
using Windows.Storage.Streams;

namespace PlotMyFace
{
    public struct DitherResult
    {
        public uint width;
        public uint height;
        public byte[] pixels;
    }

    internal class Dither
    {
        const int kBWThreshold = -250;
        static public float[] errorTable;

        internal static byte getLuminance(byte r, byte g, byte b)
        {
            byte Max = Math.Max(r, Math.Max(g, b));
            byte Min = Math.Min(r, Math.Min(g, b));
            return (byte)((Max + Min) / 2);
        }
        enum dithermode { Sierra2, SierraLite, FloydSteinberg};

        internal static async Task<DitherResult> ditherFile(StorageFile file, uint outputWidth, uint outputHeight)
        {
            int pointCount = 0;
            dithermode dm = dithermode.SierraLite;
            DitherResult result = new DitherResult();
            errorTable = new float[outputWidth * outputHeight];

            using (IRandomAccessStream stream = await file.OpenReadAsync())
            {

                var decoder = await BitmapDecoder.CreateAsync(stream);

                var bitmapTransform = new BitmapTransform
                {
                    ScaledWidth = outputWidth,
                    ScaledHeight = outputHeight
                };

                var thumbnailColorProvider = await decoder.GetPixelDataAsync(
                                BitmapPixelFormat.Rgba8,
                                BitmapAlphaMode.Straight,
                                bitmapTransform,
                                ExifOrientationMode.IgnoreExifOrientation,
                                ColorManagementMode.DoNotColorManage);

                var thumbnailColorArray = thumbnailColorProvider.DetachPixelData();

                result.width = outputWidth;
                result.height = outputHeight;

                var thumbnailBWArray = new byte[result.width * result.height];
                var thumbnailDitheredArray = new byte[result.width * result.height];

                // First Pass, average each triad
                for (int i = 0; i < thumbnailBWArray.Length; i++)
                {
                    var r = thumbnailColorArray[i * 4 + 0];
                    var g = thumbnailColorArray[i * 4 + 1];
                    var b = thumbnailColorArray[i * 4 + 2];

                    thumbnailBWArray[i] = getLuminance(r, g, b);
                }

                int newValue;
                float error;
                for (var pass = 0; pass < 1; pass++)
                {
                    for (int x = 0; x < result.width; x++)
                    {
                        for (int y = 0; y < result.height; y++)
                        {
                            int index = y * (int)result.width + x;

                            newValue = thumbnailBWArray[index] + (int)errorTable[index];

                            if (newValue >= kBWThreshold)
                            {
                                // Set white
                                error = newValue - 255;
                                thumbnailDitheredArray[index] = 255;
                            }
                            else
                            {
                                // Set Black
                                pointCount++;
                                error = newValue;
                                thumbnailDitheredArray[index] = 0;
                            }

                            switch (dm)
                            {
                                case dithermode.FloydSteinberg:
                                    {
                                        if (x + 1 < result.width)
                                        {
                                            errorTable[index + 1] += (error * 7 / 16);
                                        }

                                        if (y + 1 < result.height)
                                        {
                                            if (x - 1 >= 0)
                                            {
                                                errorTable[index + result.width - 1] += (error * 3 / 16);
                                            }

                                            errorTable[index + result.width] += (error * 5 / 16);

                                            if (x + 1 < result.width)
                                            {
                                                errorTable[index + result.width + 1] += (error * 1 / 16);
                                            }
                                        }
                                    }
                                    break;
                                case dithermode.Sierra2:
                                    {
                                        if (x + 1 < result.width)
                                        {
                                            errorTable[index + 1] += (error * 4 / 16);
                                        }
                                        if (x + 2 < result.width)
                                        {
                                            errorTable[index + 2] += (error * 3 / 16);
                                        }

                                        if (y + 1 < result.height)
                                        {
                                            if (x - 2 >= 0)
                                            {
                                                errorTable[index + result.width - 2] += (error * 1 / 16);
                                            }
                                            if (x - 1 >= 0)
                                            {
                                                errorTable[index + result.width - 1] += (error * 2 / 16);
                                            }

                                            errorTable[index + result.width] += (error * 3 / 16);

                                            if (x + 1 < result.width)
                                            {
                                                errorTable[index + result.width + 1] += (error * 2 / 16);
                                            }

                                            if (x + 2 < result.width)
                                            {
                                                errorTable[index + result.width + 2] += (error * 1 / 16);
                                            }
                                        }

                                    }
                                    break;

                                case dithermode.SierraLite:
                                    {
                                        if (x + 1 < result.width)
                                        {
                                            errorTable[index + 1] += (error * 2 / 4);
                                        }

                                        if (y + 1 < result.height)
                                        {
                                            if (x - 1 >= 0)
                                            {
                                                errorTable[index + result.width - 1] += (error * 1 / 4);
                                            }

                                            errorTable[index + result.width] += (error * 1 / 4);

                                        }
                                    }
                                    break;
                            }

                        }
                    }
                }
                Debug.WriteLine("Point count: " + pointCount);

                result.pixels =  thumbnailDitheredArray;

                return result;
            }
        }
    }
}


text:
@interface StoryViewModel ()

@property (strong, nonatomic) NSArray* storiesArray;

@end

@implementation StoryViewModel

- (instancetype)initWithCellIdentifier:(NSString*)cellIdentifier configureCellBlock:(TableViewCellConfigureBlock)configureCellBlock;
{
    self = [super init];
    if (!self)
        return nil;
    _dataSource = [[ArrayDataSource alloc] initWithItems:@[] cellIdentifier:cellIdentifier configureCellBlock:configureCellBlock];
    // Data binding
    RAC(self.dataSource, items) = [self loadStoriesForSection:@"" page:1];
    RAC(self, storiesArray) = RACObserve(self.dataSource, items);

    return self;
}

- (RACSignal*)loadStoriesForSection:(NSString*)section page:(NSInteger)page
{
    return [[[[StoryClient storiesForSection:section page:page] map:^id(NSDictionary* JSONData) {
        self.active = NO;
        return [MTLJSONAdapter modelsOfClass:Story.class fromJSONArray:JSONData[@"stories"] error:nil];
    }] logError] catchTo:[RACSignal empty]];
}

@end


text:
{% extends 'base.html' %}

{% load static %}

{% block title %}
  Налаштування сайту
{% endblock %}

{% block content %}

    {% for m in manufacturers %}
    {{ m.name }} ({{ m.products_qty }})

    {% endfor %}

    Створити виробника

{% endblock %}

{% block contacts %}{% endblock contacts %}


text:
<?xml version='1.0'?>
<!--
  language_greek.xml
  =========================================================================
  This file is originally part of the JMathTeX Library - http://jmathtex.sourceforge.net

  Copyright (C) 2009 DENIZET Calixte

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or (at
  your option) any later version.

  This program is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  General Public License for more details.

  A copy of the GNU General Public License can be found in the file
  LICENSE.txt provided with the source distribution of this program (see
  the META-INF directory in the source jar). This license can also be
  found on the GNU website at http://www.gnu.org/licenses/gpl.html.

  If you did not receive a copy of the GNU General Public License along
  with this program, contact the lead developer, or write to the Free
  Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  02110-1301, USA.

-->

<TeXFont>

<SymbolMappings>
  <Mapping include="fonts/jlm_greek.map.xml" />
</SymbolMappings>

<FontDescriptions>
  <Metrics include="fonts/jlm_fcmbipg.xml" />
  <Metrics include="fonts/jlm_fcmbpg.xml" />
  <Metrics include="fonts/jlm_fcmripg.xml" />
  <Metrics include="fonts/jlm_fcmrpg.xml" />
  <Metrics include="fonts/jlm_fcsbpg.xml" />
  <Metrics include="fonts/jlm_fcsropg.xml" />
  <Metrics include="fonts/jlm_fcsrpg.xml" />
  <Metrics include="fonts/jlm_fctrpg.xml" />
</FontDescriptions>

<TeXSymbols include="fonts/symbols_greek.xml" />

<FormulaSettings include="fonts/mappings_greek.xml" />

</TeXFont>


text:
from datetime import datetime
from django.db import models

class EndUser(models.Model):
	'''
	Part of accessing register enlisting EndUser details.
	Inherited by Student and Employee Models.

	Contains common user specific details - name, card_number, gender,
	phone_number.
	'''

	gender_choices = (
		(u'F', u'Female'),
		(u'M', u'Male'),
		(u'U', u'Unspecified'),
	)

	name = models.CharField(max_length=50)
	card_number = models.CharField(max_length=50)
	gender = models.CharField(max_length=1, choices=gender_choices,)
	phone_number = models.CharField(max_length=15)

	def __unicode__(self):
		return self.name

class Student(EndUser):
	'''
	Student peculiar schema.
	comprises of details kin to student and book issue details.
	'''

	roll_number = models.CharField(max_length=20)
	branch = models.CharField(max_length=30)
	batch = models.CharField(max_length=4, default = datetime.now().year)
	semester = models.CharField(max_length=1)

	def __unicode__(self):
		return '%s | %s' % (self.name, self.roll_number)

class Employee(EndUser):
	'''
	Employee or faculty peculiar schema.
	comprises of details kin to employee and book issue details.
	'''

	employee_id = models.CharField(max_length=25)
	joining_date = models.DateField()
	department = models.CharField(max_length=50)
	designation = models.CharField(max_length=50)

	def __unicode__(self):
		return u'%s | %s' %(self.name, self.employee_id)


text:
package org.robovm.samples.samplephotosapp.ui;

import org.robovm.apple.uikit.UICollectionViewCell;
import org.robovm.apple.uikit.UIImage;
import org.robovm.apple.uikit.UIImageView;
import org.robovm.objc.annotation.CustomClass;
import org.robovm.objc.annotation.IBOutlet;

@CustomClass("AAPLGridViewCell")
public class AAPLGridViewCell extends UICollectionViewCell {
    private UIImage thumbnailImage;
    private UIImageView imageView;

    public void setThumbnailImage(UIImage thumbnailImage) {
        this.thumbnailImage = thumbnailImage;
        imageView.setImage(thumbnailImage);
    }

    public UIImage getThumbnailImage() {
        return thumbnailImage;
    }

    @IBOutlet
    private void setImageView(UIImageView imageView) {
        this.imageView = imageView;
    }
}


text:
<?php
declare(strict_types = 1);
/**
 * URI Regex Rule
 *
 * @package Evoke\Network\URI\Router\Rule
 */
namespace Evoke\Network\URI\Router\Rule;

use InvalidArgumentException;

/**
 * URI Regex Rule
 *
 * @author    Paul Young <evoke@youngish.org>
 * @copyright Copyright (c) 2015 Paul Young
 * @license   MIT
 * @package   Evoke\Network\URI\Router\Rule
 */
class Regex extends Rule
{
    /**
     * Controller regex match and replace.
     * @var string[]
     */
    protected $controller;

    /**
     * Regex to determine whether this rule matches.
     * @var string
     */
    protected $match;

    /**
     * Parameters each with a key and value regex for match and replace.
     * Example:
     *

     * [
     *     ['key'   => ['Match' => 'regex', 'Replace' => 'replacement'],
     *      'value' => ['Match' => 'regex', 'Replace' => 'replacement']]
     * ]
     *

     */
    protected $params;

    /**
     * Construct the Regex Rule.
     *
     * @param string[] $controller    Controller regex match and replace.
     * @param string   $match         Regex to determine whether the rule matches.
     * @param array[]  $params        Parameters each with a key and value regex for match and replacement.
     * @param bool     $authoritative Whether the rule is authoritative.
     * @throws InvalidArgumentException
     */
    public function __construct(array $controller, string $match, array $params, bool $authoritative = false)
    {
        parent::__construct($authoritative);
        $invalidArgs = false;

        foreach ($params as $param) {
            if (!isset(
                $param['key']['match'],
                $param['key']['replace'],
                $param['value']['match'],
                $param['value']['replace']
            )) {
                $invalidArgs = true;
                break;
            }
        }

        if ($invalidArgs || !isset($controller['match'], $controller['replace'])) {
            throw new InvalidArgumentException('Bad Arguments');
        }

        $this->controller = $controller;
        $this->match      = $match;
        $this->params     = $params;
    }

    /******************/
    /* Public Methods */
    /******************/

    /**
     * Get the controller.
     *
     * @return string The uri with the match replaced.
     */
    public function getController() : string
    {
        return preg_replace($this->controller['match'], $this->controller['replace'], $this->uri);
    }

    /**
     * Get any parameters.
     *
     * @return mixed[] Parameters from the URI.
     */
    public function getParams() : array
    {
        $paramsFound = [];

        foreach ($this->params as $param) {
            if (preg_match($param['key']['match'], $this->uri) &&
                preg_match($param['value']['match'], $this->uri)
            ) {
                $paramsFound[preg_replace($param['key']['match'], $param['key']['replace'], $this->uri)] =
                    preg_replace($param['value']['match'], $param['value']['replace'], $this->uri);
            }
        }

        return $paramsFound;
    }

    /**
     * Check the uri to see if it matches.
     *
     * @return bool Whether the uri is matched.
     */
    public function isMatch() : bool
    {
        return preg_match($this->match, $this->uri) > 0;
    }
}
// EOF