text:
package co.yeisonvargas.battleship.dto;

import co.yeisonvargas.battleship.business.Game;

import java.util.ArrayList;

/**
 * Created by yeisonvargas on 7/06/16.
 */
public class Ocean {
    private ArrayList<Ship> ships;
    private Player owner;

    public Ocean(Player owner) {
        this.ships = new ArrayList<>();
        this.owner = owner;
    }

    public String [] insertShip(Ship newShip) {
        System.out.println("Method: insertShip...");
        if(isOcupate(newShip)) {
            System.out.println("It's ocupated.");
            this.printShips();
            return null;
        }
        this.ships.add(newShip);
        switch (newShip.getSize()) {
            case 2:
                Game.shipsLeftTwoSquares--;
                break;
            case 3:
                Game.shipsLeftThreeSquares--;
                break;
            case 4:
                Game.shipsLeftFourSquares--;
                break;
            case 5:
                Game.shipsLeftFiveSquares--;
                break;
            default:
                break;
        }
        System.out.println("Printing ships...");
        this.printShips();
        return newShip.getPositions();
    }

    private void printShips() {
        for(Ship a: this.ships) {
            System.out.println(a.toString());
        }
    }

    public String [] attackShip(String coordinate) {
        System.out.println("Printing ATTACK SHIPS");

        for (Ship item: this.ships) {
            System.out.println(item.getStart() + " - " + item.getEnd());
            if(isThereCollision(coordinate, item.getStart(), item.getEnd(), item.isVertical())){
                // TODO: Return coordinate of sunken ship and register in table

                System.out.println("Hubo colisión en: " + item.getStart() + " - " + item.getEnd());

                return item.getPositions();
            }
        }

        // TODO: Return coordinate of shot and register in table
        String [] result = {coordinate};
        return result;
    }

    private boolean isOcupate(Ship newShip) {
        System.out.println("Method: Is Ocupate...");
        String [] positionsNewShip = newShip.getPositions();
        for(Ship item: this.ships) {
            for(String position: item.getPositions()) {
                for(String positionNewShip: positionsNewShip) {
                    if(position.equals(positionNewShip)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    private boolean isThereCollision(String coordinate, String start, String end, boolean isVertical) {
        if(isVertical) {
            System.out.println("Vertical");
            if(coordinate.split(",")[1] == start.split(",")[1]){
                System.out.println("Vertical..OK");
                System.out.println(Integer.parseInt(start.split(",")[0]));
                System.out.println(Integer.parseInt(coordinate.split(",")[0]));

                System.out.println(Integer.parseInt(end.split(",")[0]));

                if(Integer.parseInt(start.split(",")[0]) >= Integer.parseInt(coordinate.split(",")[0]) && Integer.parseInt(end.split(",")[0]) <= Integer.parseInt(coordinate.split(",")[0])  ||
                        Integer.parseInt(end.split(",")[0]) >= Integer.parseInt(coordinate.split(",")[0]) && Integer.parseInt(coordinate.split(",")[0]) <= Integer.parseInt(start.split(",")[0])) {
                    return true;
                }
                return false;
            }
            return false;
        }

        System.out.println("HORIZONTAL");

        // Horizontal Case

            System.out.println("HORIZONTAL... OK");
            System.out.println(Integer.parseInt(start.split(",")[1]));
            System.out.println(Integer.parseInt(coordinate.split(",")[1]));

            System.out.println(Integer.parseInt(end.split(",")[1]));

            if(Integer.parseInt(start.split(",")[1]) >= Integer.parseInt(coordinate.split(",")[1]) && Integer.parseInt(coordinate.split(",")[1]) <= Integer.parseInt(end.split(",")[1]) ||
                    Integer.parseInt(end.split(",")[1]) >= Integer.parseInt(coordinate.split(",")[1]) && Integer.parseInt(coordinate.split(",")[1]) <= Integer.parseInt(start.split(",")[1])) {
                return true;
            }
            return false;

    }

}


text:
namespace quiche {

NET_EXPORT_PRIVATE absl::optional<int64_t> QuicheUtcDateTimeToUnixSecondsImpl(
    int year,
    int month,
    int day,
    int hour,
    int minute,
    int second);

}  // namespace quiche

#endif  // NET_THIRD_PARTY_QUICHE_OVERRIDES_QUICHE_PLATFORM_IMPL_QUICHE_TIME_UTILS_IMPL_H_

redpajama_set_name: RedPajamaGithub


text:
#import "AppDelegate.h"
#import "AboutDialog.h"
#import "AboutViewController.h"

@implementation AboutDialog

- (id) init {
	self = [super init];
	if (self == nil)
		return nil;

	NSString *aboutTitle = [NSString stringWithFormat:@"Mumble for iPhoneOS"];
	NSString *aboutMessage = @"Low-latency, high-quality VoIP app";

	alert = [[UIAlertView alloc] initWithTitle:aboutTitle message:aboutMessage delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
	websiteButton = [alert addButtonWithTitle:@"Website"];
	contribButton = [alert addButtonWithTitle:@"Contributors"];
	legalButton = [alert addButtonWithTitle:@"Legal"];

	return self;
}
- (void) dealloc {
	[alert release];

	[super dealloc];
}

- (void) show {
	[alert show];
}

- (void) alertView:(UIAlertView *)alert didDismissWithButtonIndex:(NSInteger)buttonIndex {
	AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
	if (buttonIndex == websiteButton) {
		[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.mumble.info/"]];
	} else if (buttonIndex == contribButton) {
		AboutViewController *contrib = [[[AboutViewController alloc] initWithContent:@"Contributors"] autorelease];
		[[appDelegate navigationController] pushViewController:contrib animated:YES];
	} else if (buttonIndex == legalButton) {
		AboutViewController *legal = [[[AboutViewController alloc] initWithContent:@"Legal"] autorelease];
		[[appDelegate navigationController] pushViewController:legal animated:YES];
	}
	[self release];
}

+ (void) show {
	AboutDialog *about = [[AboutDialog alloc] init];
	[about show];
	// AboutDialog will release itself when done. This is not a leak!
}

@end


text:
package org.gdg.frisbee.android.api.model;

import java.util.ArrayList;

public class GdeList extends ArrayList<Gde> {
}


text:
require 'net/ssh'
require 'net/ssh/proxy/command'
require 'with_retries'

def check_prerequisites
  return if ssh_agent_has_key?
  raise 'No ssh key registered in ssh-agent. Run `ssh-add' \
        '<path-to-private-key>`to add a key.'
end

def ssh_agent_has_key?
  system('ssh-add -l')
end

def ssh_exec(ip_address, command, via_host_ip = nil, max_retries = 5)
  status = {}
  stdout = String.new('')
  stderr = String.new('')

  options = { forward_agent: true, use_agent: true, verify_host_key: Net::SSH::Verifiers::Null.new }
  unless via_host_ip.nil?
    proxy = Net::SSH::Proxy::Command.new("ssh core@#{via_host_ip} -W %h:%p -o StrictHostKeyChecking=no")
    options[:proxy] = proxy
  end

  Retriable.with_retries(Errno::ECONNREFUSED, Errno::ECONNRESET, Errno::ETIMEDOUT,
                         Net::SSH::ConnectionTimeout, Net::SSH::Disconnect,
                         IOError, limit: max_retries, sleep: 10) do
    Net::SSH.start(ip_address, 'core', options) do |ssh|
      ssh.exec! command, status: status do |_ch, stream, data|
        case stream
        when :stdout
          stdout << data
        when :stderr
          stderr << data
        end
      end
    end
  end
  [stdout, stderr, status[:exit_code]]
end

def create_if_not_exist_and_add_ssh_key
  key_file = '${HOME}/.ssh/id_rsa'
  ssh_file = File.join(Dir.home, '.ssh/id_rsa')
  `KEY_FILE=#{key_file} && ssh-keygen -f "${KEY_FILE}" -t rsa -N ''` unless File.exist?(ssh_file)
  %x(eval `ssh-agent -a /tmp/ssh-agent.sock`; ssh-add ${HOME}/.ssh/id_rsa)
  ENV['SSH_AUTH_SOCK'] = '/tmp/ssh-agent.sock'
end


text:
<!DOCTYPE html>
<html ng-app="Examples">
    <head>
        <title>Kiiri Angular Directive Examples</title>
        <meta charset="utf-8">
        <link href='https://fonts.googleapis.com/css?family=Quattrocento+Sans:400,700' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
        <link type="text/css" rel="stylesheet" href="../build/kiiri-angular-directives.min.css"></link>
        <style>
            .example-modal {
                margin: 0px auto;
                width: 500px;
                padding: 40px;
            }

            .example-modal .title {
                font-size: 24px;
                font-weight: 300;
                color: #666666;
                text-align: center;
                margin-bottom: 40px;
                line-height: 24px;
            }

            .kiiri-input-field, .kiiri-text-area {
                margin-bottom: 10px;
            }

        </style>
    </head>
    <body ng-controller="ExampleController">
        <angular-button click="sidePanelOpen = true">Open Side Panel</angular-button>
        <side-panel open="sidePanelOpen">
            SOME CONTENT
        </side-panel>

        <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
        <script type="text/javascript" src="https://code.angularjs.org/1.4.7/angular.min.js"></script>
        <script type="text/javascript" src="../build/kiiri-angular-directives.min.js"></script>

        <script>
            var examples = angular.module("Examples", ["kiiri.angular"]);

            angular.module("Examples").controller("ExampleController", function($scope, $timeout) {

            });
        </script>
    </body>
</html>


text:
use std::io::prelude::*;
use std::net::TcpStream;

fn main() {
    let mut stream = TcpStream::connect("127.0.0.1:8000").expect("connection failed");

  //  write!(stream,"hello from the client!\n").expect("write failed");
 }


text:
'use strict';
import React from 'react';

const SellerSubmenu = () => {
  return (

 Profil vanzator

 Administrare produse

 Rapoarte

  );
};

export default SellerSubmenu;


text:
using System;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;

namespace Falken
{
    /// <summary>
    /// <c>Category</c> Establishes a connection with a Falken's
    /// CategoricalAttribute. This class maps
    /// the name of each entry in the enum to a index.
    /// </summary>
    public sealed class Category : Falken.AttributeBase
    {

        /// <summary>
        /// <c>EnumTypeMismatchException</c> thrown when
        /// the enum created for the category attribute
        /// is different to the one being requested.
        /// </summary>
        [Serializable]
        public class EnumTypeMismatchException : Exception
        {
            internal EnumTypeMismatchException()
            {
            }

            internal EnumTypeMismatchException(string message)
              : base(message) { }

            internal EnumTypeMismatchException(string message, Exception inner)
              : base(message, inner) { }
        }

        // Enum used to create this category.
        private Type _enumType = null;

        // Mapping of enum names to indexes.
        private Dictionary<string, int> _nameIndexMap =
          new Dictionary<string, int>();

        // List of category values. Used only
        // when constructing attributes when not using reflection.
        private string[] _categoryValues = null;

        /// Invalid enumerated code of the bound variable, used to mark unset
        /// attributes
        private int _badEnumCode;

        /// <summary>
        /// Verify that the given object is an enumeration.
        /// </summary>
        static internal bool CanConvertToCategoryType(object obj)
        {
            return obj.GetType().IsEnum;
        }

        /// <summary>
        /// Create an empty Falken.Category that will be bound later
        /// using a field from a class that contains this attribute.
        /// </summary>
        public Category()
        {
        }

        /// <summary>
        /// Create an Falken.Category with the given category values.
        /// <exception>
        /// ArgumentNullException thrown when name is null.
        /// </exception>
        /// <exception>
        /// ArgumentException thrown when there's no category.
        /// </exception>
        /// </summary>
        public Category(string name, IEnumerable<string> categoryValues) : base(name)
        {
            InitializeCategoryValues(categoryValues);
        }

        /// <summary>
        /// Create a Falken.Category with the given category values that will be bound
        /// later using a field from a class that contains this attribute.
        /// <exception>
        /// ArgumentNullException thrown when name is null.
        /// </exception>
        /// <exception>
        /// ArgumentException thrown when there's no category.
        /// </exception>
        /// </summary>
        public Category(IEnumerable<string> categoryValues)
        {
            InitializeCategoryValues(categoryValues);
        }

        /// <summary>
        /// Initialize category values during construction.
        /// </summary>
        private void InitializeCategoryValues(IEnumerable<string> categoryValues)
        {
            if (!categoryValues.Any())
            {
                throw new ArgumentException(
                  "There's no category in the given category values.");
            }
            _categoryValues = Enumerable.ToArray<string>(categoryValues);
        }

        /// <summary>
        /// Get all the category values that this attribute has
        /// (the name of each enum entry used to create this).
        /// </summary>
        public IList<string> CategoryValues
        {
            get
            {
                if (Bound)
                {
                    Read();
                    return new List<string>(_attribute.category_values());
                }
                throw new AttributeNotBoundException(
                  "Can't retrieve the value if the attribute is not bound.");
            }
        }

        /// <summary>
        /// Get Falken's categorical attribute value as index of the enum.
        /// <exception> AttributeNotBoundException if attribute is
        /// not bound. </exception>
        /// <returns> Value stored in Falken's attribute. </returns>
        /// </summary>
        public int Value
        {
            get
            {
                if (Bound)
                {
                    Read();
                    return _attribute.category();
                }
                throw new AttributeNotBoundException(
                  "Can't retrieve the value if the attribute is not bound.");
            }
            set
            {
                if (Bound)
                {
                    _attribute.set_category(value);
                    Write();
                    return;
                }
                throw new AttributeNotBoundException(
                  "Can't set value if the attribute is not bound.");
            }
        }

        /// <summary>
        /// Get Falken's categorical attribute value casted to the type
        /// that was created with.
        /// <exception> AttributeNotBoundException if attribute is
        /// not bound. </exception>
        /// <exception> EnumTypeMismatchException if the type of the enum
        /// to cast is different from the one used to create this category.
        /// </exception>
        /// <returns> Value stored in Falken's attribute casted to the enum used.
        /// </returns>
        /// </summary>
        public T AsEnum<T>()
        {
            if (!Bound)
            {
                throw new AttributeNotBoundException(
                  "Can't get value as enum if the attribute is not bound.");
            }
            if (typeof(T) != _enumType)
            {
                throw new EnumTypeMismatchException(
                  String.Format(
                    "Can't cast to a different enum type. Given enum type is " +
                    "{0} and this attribute was created with a {1}",
                    typeof(T).ToString(), _enumType.ToString()));
            }
            var values = Enum.GetValues(_enumType);
            int categoryValue = _attribute.category();
            if (categoryValue >= values.Length)
            {
                throw new IndexOutOfRangeException("Category value is out of range");
            }
            return (T)values.GetValue(categoryValue);
        }

        /// <summary>
        /// Establish a connection between a C# attribute and a Falken's attribute.
        /// </summary>
        /// <param name="fieldInfo">Metadata information of the field this is being bound
        /// to.</param>
        /// <param name="fieldContainer">Object that contains the value of the field.</param>
        /// <param name="container">Internal container to add the attribute to.</param>
        /// <exception>AlreadyBoundException thrown when trying to bind the attribute when it was
        /// bound already.</exception>
        internal override void BindAttribute(FieldInfo fieldInfo, object fieldContainer,
                                             FalkenInternal.falken.AttributeContainer container)
        {
            ThrowIfBound(fieldInfo);
            string[] enumNames;
            SetNameToFieldName(fieldInfo, fieldContainer);

            if (fieldInfo != null && fieldContainer != null)
            {
                var value = fieldInfo.GetValue(fieldContainer);
                if (value != this)
                {
                    if (!CanConvertToCategoryType(value))
                    {
                        ClearBindings();
                        throw new UnsupportedFalkenTypeException(
                            $"Field '{fieldInfo.Name}' is not an enum");
                    }

                    Type fieldType = fieldInfo.FieldType;

                    enumNames = Enum.GetNames(fieldType);
                    _enumType = fieldType;

                    // Find a value that can be used as invalid or out of range
                    // in the enum encoding. We look for the largest
                    // positive code + 1.
                    var enumeratedTypeValuesArray = Enum.GetValues(_enumType);
                    Array.Sort(enumeratedTypeValuesArray);
                    _badEnumCode = (int)enumeratedTypeValuesArray.GetValue(
                        enumeratedTypeValuesArray.Length - 1) + 1;
                }
                else
                {
                    // Attribute represents a field containing itself.
                    enumNames = _categoryValues;
                }
            }
            else
            {
                // Attribute represents no field.
                enumNames = _categoryValues;
                ClearBindings();
            }
            int index = 0;
            foreach (string enumName in enumNames)
            {
                _nameIndexMap[enumName] = index;
                ++index;
            }
            SetFalkenInternalAttribute(new FalkenInternal.falken.AttributeBase(
                                           container, _name,
                                           new FalkenInternal.std.StringVector(enumNames)),
                                       fieldInfo, fieldContainer);
            // Sync with the initial value and then mark as invalid
            Read();
            InvalidateNonFalkenFieldValue();
        }

        /// <summary>
        /// Clear all field and attribute bindings.
        /// </summary>
        protected override void ClearBindings()
        {
            base.ClearBindings();
            // Deallocate fields used to construct the attribute.
            _categoryValues = null;
            _enumType = null;
        }

        /// <summary>
        /// Read a field and check if the value is valid.
        /// </summary>
        /// <returns>
        /// Object boxed version of the attribute value.
        /// or null if invalid or unable to readValue stored in Falken's attribute.
        /// </returns>
        internal override object ReadFieldIfValid() {
            var value = base.ReadField();
            return (value != null) && (CastTo<int>(value) != _badEnumCode) ?
                _enumType.GetEnumName(value) : null;
        }

        /// <summary>
        /// Update Falken's attribute value to reflect C# field's value.
        /// </summary>
        internal override void Read()
        {
            var value = ReadFieldIfValid();
            if (value != null)
            {
                _attribute.set_category(_nameIndexMap[(string)value]);
            }
        }

        /// <summary>
        /// Update C# field's value to match Falken's attribute value.
        /// </summary>
        internal override void Write()
        {
            if (Bound && HasForeignFieldValue && _enumType != null)
            {
                // If this Category attribute mirrors a primitive enum field, update that field.
                WriteField(Enum.GetValues(_enumType).GetValue(_attribute.category()));
            }
        }

        /// <summary>
        /// Invalidates the value of any non-Falken field represented by this attribute.
        /// </summary>
        internal override void InvalidateNonFalkenFieldValue() {
            if (HasForeignFieldValue)
            {
                WriteField(Convert.ChangeType(_badEnumCode, _enumType.GetEnumUnderlyingType()));
            }
        }
    }
}


text:
.navbar,
.breadcrumb,
.toc-separator
#toc-bar,
#toc-sidebar,
footer,
.subfooter {
	display: none !important;
}

body {
  padding-top: 0px !important;
}

/* CSS below taken from HTML5 Boilerplate */
* {
  background: transparent !important;
  color: #000 !important; /* Black prints faster: h5bp.com/s */
  box-shadow:none !important;
  text-shadow: none !important;
}

a,
a:visited {
  text-decoration: underline;
}

a[href]:after {
  content: " (" attr(href) ")";
}

abbr[title]:after {
  content: " (" attr(title) ")";
}

/*
 * Don't show links for images, or javascript/internal links, or header links
 */

header a:after,
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
  content: "" !important;
}

pre,
blockquote {
  border: 1px solid #999;
  page-break-inside: avoid;
}

thead {
  display: table-header-group; /* h5bp.com/t */
}

tr,
img {
  page-break-inside: avoid;
}

img {
  max-width: 100% !important;
}

@page {
  margin: 0.5cm;
}

p,
h2,
h3 {
  orphans: 3;
  widows: 3;
}

h2,
h3 {
  page-break-after: avoid;
}


text:
package org.robolectric.res;

import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import org.w3c.dom.Document;

/**
 * Loader for xml property files.
 *

 *
Given a resource file a concrete implementation of {@link XmlResourceParser}
 * is returned. The returned implementation is based on the current Android
 * implementation. Please see the android source code for further details.
 *
 * @author msama (michele@swiftkey.net)
 * @see https://github.com/android/platform_frameworks_base/blob/master/core/java/android/content/res/XmlBlock.java
 * @see Resources#getXml(int)
 */
public class XmlFileLoader extends XmlLoader {
  private final ResBundle<Document> resBundle;

  public XmlFileLoader(ResBundle<Document> resBundle) {
    this.resBundle = resBundle;
  }

  @Override
  protected void processResourceXml(FsFile xmlFile, XpathResourceXmlLoader.XmlNode xmlNode, XmlContext xmlContext) throws Exception {
    resBundle.put("xml", xmlFile.getName().replace(".xml", ""), parse(xmlFile), xmlContext);
  }
}


text:
import sys
import yaml
file = str(sys.argv[1])

def determine(item):
    if ((item.get('action')=="add-br" and item.get('name')=="br-prv") or \
       (item.get('action')=="add-br" and item.get('name')=="br-aux") or \
       (item.get('action')=="add-br" and item.get('name')=="br-floating") or \
       (item.get('action')=="add-port" and item.get('bridge')=="br-aux") or \
       (item.get('action')=="add-patch")):
        return True
    else:
        return False

with open (file, 'r') as ymlfile:
    cfg = yaml.load(ymlfile)

cfg['network_scheme']['endpoints'].pop('br-floating', None)
cfg['network_scheme']['endpoints'].pop('br-prv', None)
cfg['network_scheme']['roles'].pop('neutron/floating', None)
cfg['network_scheme']['roles'].pop('neutron/private', None)

cfg['network_scheme']['transformations'][:] = [item for item in cfg['network_scheme']['transformations'] if not determine(item)]

with open (file, 'w') as ymlfile:
    yaml.dump(cfg, ymlfile, default_flow_style=False)


text:
<?php

namespace Kunstmaan\TranslatorBundle\Service\Menu;

use Kunstmaan\AdminBundle\Helper\Menu\MenuAdaptorInterface;
use Kunstmaan\AdminBundle\Helper\Menu\MenuBuilder;
use Kunstmaan\AdminBundle\Helper\Menu\MenuItem;
use Symfony\Component\HttpFoundation\Request;

class TranslatorMenuAdaptor implements MenuAdaptorInterface
{
    public function adaptChildren(MenuBuilder $menu, array &$children, MenuItem $parent = null, Request $request = null)
    {
        if (\is_null($parent)) {
            return;
        }

        if ('KunstmaanAdminBundle_settings' == $parent->getRoute()) {
            $menuItem = new MenuItem($menu);
            $menuItem
                ->setRoute('KunstmaanTranslatorBundle_settings_translations')
                ->setLabel('translator.translator.title')
                ->setUniqueId('Translations')
                ->setParent($parent);
            if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
                $menuItem->setActive(true);
                $parent->setActive(true);
            }
            $children[] = $menuItem;
        } elseif ('KunstmaanTranslatorBundle_settings_translations' == $parent->getRoute()) {
            $menuItem = new MenuItem($menu);
            $menuItem
                ->setRoute('KunstmaanTranslatorBundle_settings_translations_add')
                ->setUniqueId('Add translation')
                ->setLabel('Add translation')
                ->setParent($parent)
                ->setAppearInNavigation(false);
            if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
                $menuItem->setActive(true);
            }
            $children[] = $menuItem;

            $menuItem = new MenuItem($menu);
            $menuItem
                ->setRoute('KunstmaanTranslatorBundle_settings_translations_edit')
                ->setUniqueId('Edit translation')
                ->setLabel('Edit translation')
                ->setParent($parent)
                ->setAppearInNavigation(false);
            if (stripos($request->attributes->get('_route'), $menuItem->getRoute()) === 0) {
                $menuItem->setActive(true);
            }
            $children[] = $menuItem;
        }
    }
}


text:
import * as PIXI from 'pixi.js-legacy';
import {A_VERTEX_POSITION} from './helpers';

const MAX_ITEMS_PER_GEOMETRY = 10000;
const ITEM_VERTEX_COUNT = 4;
const ITEM_VERTEX_SIZE = 3;
const MAX_VERTEX_PER_GEOMETRY = MAX_ITEMS_PER_GEOMETRY * ITEM_VERTEX_COUNT * ITEM_VERTEX_SIZE;

class HeatmapGeometry {
    constructor() {
        /**
         * Elements array (holds {x, y, ratio} data for each heatmap item)
         * @type {Float32Array}
         */
        this.array = new Float32Array(MAX_VERTEX_PER_GEOMETRY);
        /**
         * An amount of heatmap items within array
         * @type {number}
         */
        this.pointer = 0;
        /**
         *
         * @type {PIXI.Geometry|undefined}
         */
        this.geometry = undefined;
        this.dirty = false;
        this.elementsBuffer = undefined;
        this.indexBuffer = undefined;
    }

    /**
     * Whether this buffer is completed (i.e. holds maximum amount of heatmap items)
     * @returns {boolean}
     */
    get isComplete() {
        return this.pointer >= MAX_ITEMS_PER_GEOMETRY;
    }

    /**
     * Appends heatmap item to the buffer if it is not completed
     * @param {HeatmapDataItemWithSize} [item]
     * @param {number} [ratio=0]
     */
    append(item, ratio = 0) {
        if (!item || this.isComplete) {
            return;
        }
        const pointer = this.pointer;
        const points = [
            {x: item.column, y: item.row},
            {x: item.column + (item.width || 1), y: item.row},
            {x: item.column + (item.width || 1), y: item.row + (item.height || 1)},
            {x: item.column, y: item.row + (item.height || 1)}
        ];
        for (let p = 0; p < points.length; p += 1) {
            const i = pointer * ITEM_VERTEX_COUNT * ITEM_VERTEX_SIZE + p * 3;
            this.array[i] = points[p].x;
            this.array[i + 1] = points[p].y;
            this.array[i + 2] = ratio;
        }
        this.pointer += 1;
        this.dirty = true;
    }

    /**
     * Builds elements & index buffers and returns PIXI.Geometry
     * @returns {PIXI.Geometry}
     */
    buildGeometry() {
        if (this.dirty || !this.elementsBuffer || !this.indexBuffer) {
            const itemsCount = this.pointer;
            const index = new Int32Array(itemsCount * 6);
            for (let i = 0; i < itemsCount; i++) {
                const v = i * ITEM_VERTEX_COUNT;
                index[i * 6] = v;
                index[i * 6 + 1] = v + 1;
                index[i * 6 + 2] = v + 2;
                index[i * 6 + 3] = v;
                index[i * 6 + 4] = v + 2;
                index[i * 6 + 5] = v + 3;
            }
            this.elementsBuffer = new PIXI.Buffer(this.array, true, false);
            this.indexBuffer = new PIXI.Buffer(index, true, true);
        }
        const geometry = new PIXI.Geometry();
        geometry
            .addAttribute(A_VERTEX_POSITION, this.elementsBuffer, ITEM_VERTEX_SIZE)
            .addIndex(this.indexBuffer);
        return geometry;
    }

    clear() {
        this.elementsBuffer = undefined;
        this.indexBuffer = undefined;
        this.pointer = 0;
    }

    clearGraphics() {
        if (!this.mesh) {
            return;
        }
        if (this.mesh.parent) {
            this.mesh.parent.removeChild(this.mesh);
        }
        this.mesh.destroy();
        this.mesh = undefined;
    }

    /**
     *
     * @param {PIXI.Container} container
     * @param {PIXI.Shader} program
     */
    build(container, program) {
        if (program && container) {
            const geometry = this.buildGeometry();
            if (geometry) {
                /**
                 *
                 * @type {PIXI.Mesh}
                 */
                const mesh = new PIXI.Mesh(geometry, program);
                container.addChild(mesh);
                this.clearGraphics();
                this.mesh = mesh;
                return true;
            }
        }
        return false;
    }

    destroy() {
        this.clearGraphics();
        this.indexBuffer = undefined;
        this.elementsBuffer = undefined;
        this.array = undefined;
    }
}

export default HeatmapGeometry;


text:
<?php
use Illuminate\Database\Seeder;
use App\Language;

class LanguageTableSeeder extends Seeder {

    public function run()
    {
        DB::table('languages')->delete();

        $language = new Language();
        $language->name = 'English';
        $language->lang_code = 'gb';
        $language->save();

        $language = new Language();
        $language->name = 'Српски';
        $language->lang_code = 'rs';
        $language->save();

        $language = new Language();
        $language->name = 'Bosanski';
        $language->lang_code = 'ba';
        $language->save();
    }

}


text:
data:extend({

	---- Alien Control Station
  {
    type = "radar",
    name = "AlienControlStation",
    icon = "__Natural-Evolution__/graphics/icons/AlienControlStation.png",
    flags = {"placeable-neutral", "placeable-player", "player-creation"},
	minable = {hardness = 0.8, mining_time = 1.5, result = "Building_Materials"},
	--- NOTE, when mined, you will lose the Alien artifacts! ----
    max_health = 250,
    corpse = "big-remnants",
	dying_explosion = "medium-explosion",
    resistances =
    {
      {
        type = "fire",
        percent = 70
      }
    },
    collision_box = {{-1.4, -1.4}, {1.4, 1.4}},
    selection_box = {{-1.5, -1.5}, {1.5, 1.5}},
    energy_per_sector = "15MJ",
    max_distance_of_nearby_sector_revealed = 5,
    max_distance_of_sector_revealed = 15,
    energy_per_nearby_scan = "250kJ",
    energy_source =
    {
      type = "electric",
      usage_priority = "secondary-input"
    },
    energy_usage = "500kW",
	pictures =
    {
      filename = "__Natural-Evolution__/graphics/entity/AlienControlStation.png",
		priority = "high",
		width = 128,
		height = 128,
		axially_symmetrical = false,
		apply_projection = false,
		direction_count = 16,
		line_length = 4,
	  shift = {0.225, -0.3},
    },
  },

})


text:
An Ansible role that installs the [Drupal 8 field formatter](https://github.com/Islandora-CLAW/openseadragon) and [OpenSeadragon library](https://openseadragon.github.io/) on:

* Centos/RHEL 7.x
* Ubuntu Xenial

## Role Variables

Available variables are listed below, along with default values:

Composer package to install:
```
openseadragon_composer_item: "islandora/openseadragon:dev-8.x-1.x"
```

Drupal composer root:
```
openseadragon_composer_root: "/var/www/html/drupal"
```

Drupal sites:
```
openseadragon_sites:
  - default
```

Drush path (note: if a preceding task sets drush_path, it will override the default value):
```
openseadragon_drush_path: /usr/local/bin/drush
```

Version of Openseadragon library to install:
```
openseadragon_version: 2.2.1
```

Temporary directory to download to:
```
openseadragon_temp_folder: /tmp
```

Check for an existing IIIF server configuration setting
```
openseadragon_iiiv_set_var: false
```

What to set the IIIF server to:
```
openseadragon_iiiv_server:
```

## Dependencies

* Drupal 8
* Drush
* Working IIIF image server (like [islandora.cantaloupe](https://github.com/Islandora-DevOps/ansible-role-cantaloupe))

## Example Playbook

    - hosts: webservers
      roles:
        - { role: islandora.drupal-openseadragon }

## License

MIT


text:
package net.imagej.ops.geom;

import java.util.ArrayList;
import java.util.List;

import net.imglib2.RealLocalizable;
import net.imglib2.roi.geom.real.Polygon2D;

/**
 * Utility class for Ops in the GeomNamespace.
 *
 * @author Alison Walter
 */
public final class GeomUtils {

	private GeomUtils() {
		// NB: prevent instantiation of utility class
	}

	public static List<RealLocalizable> vertices(final Polygon2D polygon) {
		final List<RealLocalizable> vertices = new ArrayList<>(polygon
			.numVertices());
		for (int i = 0; i < polygon.numVertices(); i++)
			vertices.add(polygon.vertex(i));
		return vertices;
	}
}


text:
# ToolBarLib

Android ActionBar Advanced Support Library for APIv22,v21,v19. This will be a better one for all kinds of design. This library bundled alot of design patterns in the advanced actionbar supports.

Java Android v22 v21 v19 toolBar Library advanced
Projec Website: [TOOLBARLIB](https://github.com/jjhesk/ToolBarLib)

##Features
v0.2.2
- [x] automatic show and hide softkeyboard

v0.2.1
- [x] support external Textview library
- [x] support search design redesign
- [x] support title center
- [x] support animation on search bar
- [x] support overlay/drawable backgrounds

##Quick review

- [x] Custom Textview
- [x] Center Textview alignment
![demo1](screenshot/device-2015-05-15-171739.png)

- [x] Search pattern redesigned
![demo2](screenshot/device-2015-05-15-171813.png)

##setup
[![Download](https://api.bintray.com/packages/jjhesk/maven/advancedtoolbar/images/download.svg) ](https://bintray.com/jjhesk/maven/advancedtoolbar/_latestVersion)
X.X.X please check out the above version name.
```gradle
repositories {
    maven {  url "http://dl.bintray.com/jjhesk/maven"  }
}

dependencies {
     compile 'ToolBarLib:advancedtoolbar:0.2.20'
}

```

##implementation
You can call by simple direct API from the code and it will do the magic for you.

```java

    private advBar toolbar;
    private ActionBar actionbar;
    private iOSActionBarWorker worker;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
       /* toolbar = (advBar) findViewById(R.id.toolbar);
        toolbar.colorize(R.color.red_300, this);
        setSupportActionBar(toolbar);*/
        actionbar = getSupportActionBar();
        worker = new iOSActionBarWorker(actionbar);
    }

```

call by direct API method on setup or using xml theme styling;
```java

        worker = new iOSActionBarWorker(actionbar);
        worker.setTitleLayoutArrangement(...)
        worker.setSearchLayoutArrangement(...)
        worker.setCompanyLogo(...)

```

define your own listener for action callbacks

```java

       worker.setSearchEngineListener(...)
       worker.setActionListener(...)

```
define your listener implemenations

This is the required callback action listener:
```java
implements ActionBarActionListener
```

This is the search engine action listener:
```java
implements SearchCustomActionBar.OnSearchListener
```


text:
package edu.svviewservice;

import org.json.JSONObject;

/**
* @author Edith Zavala
*/

public class SensorsData {

	private static JSONObject sensorsController = new JSONObject();
	private static JSONObject sensorsView = new JSONObject();

	public static JSONObject getSensorsController() {
		JSONObject copy;
		synchronized (SensorsData.sensorsController) {
			copy = new JSONObject(SensorsData.sensorsController.toString());
		}
		return copy;
	}

	public static JSONObject getSensorsView() {
		JSONObject copy;
		synchronized (SensorsData.sensorsView) {
			copy = new JSONObject(SensorsData.sensorsView.toString());
		}
		return copy;
	}

	public static void setSensors(JSONObject sensors) {
		String client = sensors.getString("client");
		sensors.remove("client");
		if(client.equals("controller")){
			SensorsData.sensorsController = sensors;
		}else{
			SensorsData.sensorsView = sensors;
		}
	}
}


text:
namespace SGLibrary.Framework.Criterion
{
    partial class WhereEdit
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Component Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(WhereEdit));
            this.toolStrip1 = new System.Windows.Forms.ToolStrip();
            this.WhereLabel = new System.Windows.Forms.ToolStripLabel();
            this.WhereCb = new System.Windows.Forms.ToolStripComboBox();
            this.toolStripLabel2 = new System.Windows.Forms.ToolStripLabel();
            this.SaveTs = new System.Windows.Forms.ToolStripButton();
            this.DeleteTs = new System.Windows.Forms.ToolStripButton();
            this.DefaultTs = new System.Windows.Forms.ToolStripButton();
            this.MaxResultCountCb = new System.Windows.Forms.ToolStripComboBox();
            this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
            this.QueryTs = new System.Windows.Forms.ToolStripButton();
            this.toolStripLabel3 = new System.Windows.Forms.ToolStripLabel();
            this.DataCountTs = new System.Windows.Forms.ToolStripLabel();
            this.toolStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // toolStrip1
            //
            this.toolStrip1.AutoSize = false;
            this.toolStrip1.BackColor = System.Drawing.Color.Gainsboro;
            this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.WhereLabel,
            this.WhereCb,
            this.toolStripLabel2,
            this.SaveTs,
            this.DeleteTs,
            this.DefaultTs,
            this.MaxResultCountCb,
            this.toolStripLabel1,
            this.QueryTs,
            this.toolStripLabel3,
            this.DataCountTs});
            this.toolStrip1.Location = new System.Drawing.Point(1, 1);
            this.toolStrip1.Name = "toolStrip1";
            this.toolStrip1.Size = new System.Drawing.Size(699, 30);
            this.toolStrip1.TabIndex = 0;
            this.toolStrip1.Text = "toolStrip1";
            this.toolStrip1.DoubleClick += new System.EventHandler(this.toolStrip1_DoubleClick);
            //
            // WhereLabel
            //
            this.WhereLabel.AutoSize = false;
            this.WhereLabel.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.WhereLabel.ForeColor = System.Drawing.Color.Indigo;
            this.WhereLabel.Name = "WhereLabel";
            this.WhereLabel.Size = new System.Drawing.Size(58, 30);
            this.WhereLabel.Text = "条件:";
            //
            // WhereCb
            //
            this.WhereCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.WhereCb.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.WhereCb.Name = "WhereCb";
            this.WhereCb.Size = new System.Drawing.Size(180, 30);
            this.WhereCb.SelectedIndexChanged += new System.EventHandler(this.WhereCb_SelectedIndexChanged);
            //
            // toolStripLabel2
            //
            this.toolStripLabel2.Name = "toolStripLabel2";
            this.toolStripLabel2.Size = new System.Drawing.Size(11, 27);
            this.toolStripLabel2.Text = " ";
            //
            // SaveTs
            //
            this.SaveTs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
            this.SaveTs.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.SaveTs.ForeColor = System.Drawing.Color.Indigo;
            this.SaveTs.Image = ((System.Drawing.Image)(resources.GetObject("SaveTs.Image")));
            this.SaveTs.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.SaveTs.Name = "SaveTs";
            this.SaveTs.Size = new System.Drawing.Size(39, 27);
            this.SaveTs.Text = "保存";
            this.SaveTs.Click += new System.EventHandler(this.SaveTs_Click);
            //
            // DeleteTs
            //
            this.DeleteTs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
            this.DeleteTs.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.DeleteTs.ForeColor = System.Drawing.Color.Indigo;
            this.DeleteTs.Image = ((System.Drawing.Image)(resources.GetObject("DeleteTs.Image")));
            this.DeleteTs.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.DeleteTs.Name = "DeleteTs";
            this.DeleteTs.Size = new System.Drawing.Size(39, 27);
            this.DeleteTs.Text = "删除";
            this.DeleteTs.Click += new System.EventHandler(this.DeleteTs_Click);
            //
            // DefaultTs
            //
            this.DefaultTs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
            this.DefaultTs.Font = new System.Drawing.Font("SimSun", 10.5F);
            this.DefaultTs.ForeColor = System.Drawing.Color.Indigo;
            this.DefaultTs.Image = ((System.Drawing.Image)(resources.GetObject("DefaultTs.Image")));
            this.DefaultTs.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.DefaultTs.Name = "DefaultTs";
            this.DefaultTs.Size = new System.Drawing.Size(39, 27);
            this.DefaultTs.Text = "缺省";
            this.DefaultTs.Click += new System.EventHandler(this.DefaultTs_Click);
            //
            // MaxResultCountCb
            //
            this.MaxResultCountCb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.MaxResultCountCb.Name = "MaxResultCountCb";
            this.MaxResultCountCb.Size = new System.Drawing.Size(75, 30);
            this.MaxResultCountCb.ToolTipText = "最大返回数据量";
            //
            // toolStripLabel1
            //
            this.toolStripLabel1.Name = "toolStripLabel1";
            this.toolStripLabel1.Size = new System.Drawing.Size(11, 27);
            this.toolStripLabel1.Text = " ";
            //
            // QueryTs
            //
            this.QueryTs.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
            this.QueryTs.Font = new System.Drawing.Font("SimSun", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            this.QueryTs.ForeColor = System.Drawing.Color.RoyalBlue;
            this.QueryTs.Image = ((System.Drawing.Image)(resources.GetObject("QueryTs.Image")));
            this.QueryTs.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.QueryTs.Name = "QueryTs";
            this.QueryTs.Size = new System.Drawing.Size(71, 27);
            this.QueryTs.Text = "查询数据";
            this.QueryTs.Click += new System.EventHandler(this.QueryTs_Click);
            //
            // toolStripLabel3
            //
            this.toolStripLabel3.Name = "toolStripLabel3";
            this.toolStripLabel3.Size = new System.Drawing.Size(11, 27);
            this.toolStripLabel3.Text = " ";
            //
            // DataCountTs
            //
            this.DataCountTs.ForeColor = System.Drawing.Color.Indigo;
            this.DataCountTs.Name = "DataCountTs";
            this.DataCountTs.Size = new System.Drawing.Size(71, 27);
            this.DataCountTs.Text = "DataCountTs";
            //
            // WhereEdit
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.Controls.Add(this.toolStrip1);
            this.Name = "WhereEdit";
            this.Padding = new System.Windows.Forms.Padding(1);
            this.Size = new System.Drawing.Size(701, 227);
            this.Load += new System.EventHandler(this.WherePanelUc_Load);
            this.toolStrip1.ResumeLayout(false);
            this.toolStrip1.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.ToolStrip toolStrip1;
        private System.Windows.Forms.ToolStripLabel WhereLabel;
        private System.Windows.Forms.ToolStripComboBox WhereCb;
        private System.Windows.Forms.ToolStripLabel toolStripLabel2;
        private System.Windows.Forms.ToolStripButton SaveTs;
        private System.Windows.Forms.ToolStripButton DeleteTs;
        private System.Windows.Forms.ToolStripButton QueryTs;
        private System.Windows.Forms.ToolStripButton DefaultTs;
        private System.Windows.Forms.ToolStripLabel toolStripLabel1;
        private System.Windows.Forms.ToolStripLabel DataCountTs;
        private System.Windows.Forms.ToolStripLabel toolStripLabel3;
        private System.Windows.Forms.ToolStripComboBox MaxResultCountCb;

    }
}


text:
Type an url that has not been used yet

##Save a page

Node Wiki automatically saves your changes if you:

- are inactive for 2 seconds
- move the focus out of a editable area
- upload an asset
- drop a media link to the content area

##Edit a page

- click on the area you want to edit
- make your changes
- either wait 2 seconds or click anywhere outside the editable area and the page is saved

##Delete a page

Deleting a page does not really delete a page but marks it as deleted. To restore a deleted page select _restore_ from the tasks menu. After 30 days deleted pages are wiped from the system and can not be restored again. This period is configurable.

##Upload Attachments

Drag files from your computer to the drop zone marked with _drop files here_

##Add media to content

__Drop a ...__

- __image file__ from your computer into the content area where you want the images to appear
- __image url__ from the Images side bar box or from another website to the content area to create an image element
- __link__ to create a link
- __youtube__ link to embed a youtube video
- __vimeo__ link to embed a vimeo video
- __audio__ link to create an audio element
- __video__ link to create a video element
- __slideshare__ link to embed a slideshare presentation

##Internal Linking

To link to another wiki page you can simply use the normal link functionality of the editor, select _Wiki link_ and choose a page from the select box. The links are shown with title an path divided by a pipe ("|") and sorted by path.

##Versions

Node Wiki uses [mongoose-version](https://github.com/saintedlama/mongoose-version) to create a new version on every save of a document. To restore a version go to _show versions_ in the side bar, select a version and restore it.


text:
<?php
namespace Inventory\Domain\Association;

use Inventory\Application\DTO\Association\AssociationDTO;
use Inventory\Application\DTO\Association\AssociationDTOAssembler;
use Inventory\Application\DTO\Item\ItemDTO;
use Inventory\Domain\Item\ItemSnapshot;
use Procure\Domain\GenericDoc;

/**
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
class AssociationSnapshotAssembler
{

    const EXCLUDED_FIELDS = 1;

    const EDITABLE_FIELDS = 2;

    const AUTO_GENERATED_FIELDS = [
        "id",
        "createdOn",
        "uuid",
        "createdBy",
        "lastChangeBy",
        "lastChangeOn",
        "version",
        "revisionNo",
        "company"
    ];

    /**
     *
     * @return array;
     */
    public static function findMissingPropertiesOfSnapshot()
    {
        $missingProperties = array();
        $entity = new GenericDoc();
        $dto = new ItemSnapshot();

        $reflectionClass = new \ReflectionClass($entity);
        $itemProperites = $reflectionClass->getProperties();
        foreach ($itemProperites as $property) {
            $property->setAccessible(true);
            $propertyName = $property->getName();
            if (! property_exists($dto, $propertyName)) {
                echo (sprintf("\n protected $%s;", $propertyName));

                $missingProperties[] = $propertyName;
            }
        }
        return $missingProperties;
    }

    public static function findMissingPropsInEntity()
    {
        $missingProperties = array();
        $baseObj = new BaseAssociation();

        $reflectionClass = new \ReflectionClass($baseObj);
        $baseProps = $reflectionClass->getProperties();

        $entity = AssociationDTOAssembler::getEntity();

        foreach ($baseProps as $property) {
            $propertyName = $property->getName();
            if (! property_exists($entity, $propertyName)) {
                echo (sprintf("\n protected $%s;", $propertyName));
                $missingProperties[] = $propertyName;
            }
        }
        return $missingProperties;
    }

    /**
     *
     * @return array;
     */
    public static function findMissingPropsInBaseObject()
    {
        $missingProperties = array();

        $entityProps = AssociationDTOAssembler::createDTOProperities();
        $dto = new BaseAssociation();

        foreach ($entityProps as $property) {
            $propertyName = $property->getName();
            if (! property_exists($dto, $propertyName)) {
                echo (sprintf("\n protected $%s;", $propertyName));
                $missingProperties[] = $propertyName;
            }
        }
        return $missingProperties;
    }

    /**
     *
     * @param ItemSnapshot $snapShot
     * @param ItemDTO $dto
     * @param array $editableProperties
     * @return NULL|\Inventory\Domain\Item\ItemSnapshot
     */
    public static function updateSnapshotFieldsFromDTO(ItemSnapshot $snapShot, ItemDTO $dto, $editableProperties)
    {
        if ($dto == null || ! $snapShot instanceof ItemSnapshot || $editableProperties == null)
            return null;

        $reflectionClass = new \ReflectionClass($dto);
        $props = $reflectionClass->getProperties();

        foreach ($props as $property) {
            $property->setAccessible(true);
            $propertyName = $property->getName();

            if (property_exists($snapShot, $propertyName) && in_array($propertyName, $editableProperties)) {

                if ($property->getValue($dto) == null || $property->getValue($dto) == "") {
                    $snapShot->$propertyName = null;
                } else {
                    $snapShot->$propertyName = $property->getValue($dto);
                }
            }
        }
        return $snapShot;
    }

    /**
     *
     * @param ItemSnapshot $snapShot
     * @param ItemDTO $dto
     * @param array $excludedProperties
     * @return NULL|\Inventory\Domain\Item\ItemSnapshot
     */
    public static function updateSnapshotFromDTOExcludeFields(AssociationSnapshot $snapShot, AssociationDTO $dto, $excludedProperties)
    {
        if ($dto == null || ! $snapShot instanceof AssociationSnapshot || $excludedProperties == null) {
            return null;
        }

        $reflectionClass = new \ReflectionClass($dto);
        $props = $reflectionClass->getProperties();

        foreach ($props as $property) {
            $property->setAccessible(true);
            $propertyName = $property->getName();

            if (in_array($propertyName, self::AUTO_GENERATED_FIELDS)) {
                continue;
            }

            if (property_exists($snapShot, $propertyName) && ! in_array($propertyName, $excludedProperties)) {

                if ($property->getValue($dto) == null || $property->getValue($dto) == "") {
                    $snapShot->$propertyName = null;
                } else {
                    $snapShot->$propertyName = $property->getValue($dto);
                }
            }
        }
        return $snapShot;
    }

    public static function updateSnapshotFromDTO(AssociationSnapshot $snapShot, AssociationDTO $dto)
    {
        if ($dto == null || ! $snapShot instanceof AssociationSnapshot) {
            return null;
        }

        $reflectionClass = new \ReflectionClass($dto);
        $props = $reflectionClass->getProperties();

        foreach ($props as $property) {
            $property->setAccessible(true);
            $propertyName = $property->getName();

            if (in_array($propertyName, self::AUTO_GENERATED_FIELDS)) {
                continue;
            }

            if (property_exists($snapShot, $propertyName)) {

                if ($property->getValue($dto) == null || $property->getValue($dto) == "") {
                    $snapShot->$propertyName = null;
                } else {
                    $snapShot->$propertyName = $property->getValue($dto);
                }
            }
        }
        return $snapShot;
    }

    /**
     * generete fields.
     */
    public static function createProperities()
    {
        $entity = new ItemSnapshot();
        $reflectionClass = new \ReflectionClass($entity);
        $itemProperites = $reflectionClass->getProperties();
        foreach ($itemProperites as $property) {
            $property->setAccessible(true);
            $propertyName = $property->getName();
            print "\n" . "protected $" . $propertyName . ";";
        }
    }
}


text:
umask 0027

# Aliases
vims=('nvim' 'vim', 'vi')

# Select which vim to use in order of preference. First found wins.

start_vim()
{
    for var in $vims
    do
        v=$(command -v $var)
        if [[ -n $v ]]
        then
            $v $@
            return $?
        fi
    done
}

alias vi=start_vim
alias vim=start_vim
alias svi="sudo -E vim"
alias vis='start_vim -O'

# default grep options
# Ignore VCS directories
# Ignore tags files
# Ignore binary files
alias grep="grep -I \
    --exclude-dir='.git'\
    --exclude-dir='.hg'\
    --exclude-dir='.svn'\
    --exclude-dir='.cvs'\
    --exclude='*\.pyo'\
    --exclude='*\.pyc'\
    --exclude='*~'\
    --exclude=TAGS\
    --exclude=tags"

if [ -f ~/.upkg/pcm/pcm.sh ]; then
    alias pcm='~/.upkg/pcm/pcm.sh'
fi
alias gst='git status -sb'
alias gsp='git status -uno -sb'
alias gp='git push'
alias gpl='git pull'
alias gplt='git pullt'
# alias greup='git reup'
# alias gcm='git cim'
# alias ga='git add'
alias jobs='jobs -l'
alias less=$PAGER
alias ll="ls  --group-directories-first --color=auto -l -t -h "
alias ls="ls -h --color=auto --group-directories-first"
alias open='xdg-open'
alias vif='nvim +Files'
# alias gvim='nvim-gtk'

if [[ "$TERM" == "xterm-kitty" ]]; then
    alias kcat='kitty +kitten icat'
    alias kdiff="kitty +kitten diff"
fi

# cmd_exists=$(command -v bat)
# if [[ -n $cmd_exists ]]; then
#     alias cat='bat --theme Monokai\ Extended\ Light'
# else
#     echo "Install 'bat' for a better cat"
# fi

cmd_exists=$(command -v prettyping)
if [[ -n $cmd_exists ]]; then
    alias ping='prettyping'
else
    echo "Install 'prettyping' for a better ping"
fi

# cmd_exists=$(command -v ncdu)
# if [[ -n $cmd_exists ]]; then
#     alias du='ncdu'
# else
#     echo "Install 'ncdu' for a better du"
# fi

export PATH=$HOME/bin:/usr/local/bin/nvim/bin:$PATH

if [[ -d "${HOME}/.local/bin" ]]; then
    export PATH="${HOME}/.local/bin:$PATH"
fi

if [[ -f "$HOME/.cargo/env" ]]; then
    . "$HOME/.cargo/env"
fi

if [[ -f "$HOME/.cargo/bin" ]]; then
    export PATH="${HOME}/.cargo/bin:$PATH"
fi

# SSH Keychain
if [[ -x /usr/bin/ksshaskpass ]]
then
    export SSH_ASKPASS=/usr/bin/ksshaskpass
fi

if [[ -x /usr/bin/keychain ]]
then
   eval $(keychain --quiet --eval --agents ssh --inherit any id_rsa id_dsa)
fi

# Default to a light shell if not set otherwise.
if [[ -z $TERM_META ]]
then
    export TERM_META=light
fi

export PSQL_EDITOR='nvim -c"set ft=sql"'
export BROWSER=google-chrome
export EDITOR='nvim'
export VISUAL=vim

# https://github.com/metakirby5/codi.vim
# Codi
# Usage: codi [filetype] [filename]
# codi() {
#   local syntax="${1:-python}"
#   shift
#   nvim -c \
#     "let g:startify_disable_at_vimenter = 1 |\
#     set bt=nofile ls=0 noru nonu nornu |\
#     hi ColorColumn ctermbg=NONE |\
#     hi VertSplit ctermbg=NONE |\
#     hi NonText ctermfg=0 |\
#     Codi $syntax" "$@"
# }

alias ll='ls -l'

if [[ -x /usr/bin/exa ]]; then
    alias ls='exa'
    alias ll='ls -l --header'
fi

alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'

if [[ -x /usr/bin/fzf ]]; then
    gch () {
        git checkout "$(git branch --list --sort=-refname --sort=-committerdate --color | fzf --ansi | tr -d '[:space:]')"
    }
fi


text:
<?php

//implementation of ampache's xml api
class OC_MEDIA_AMPACHE{

	/**
	* do the initial handshake
	* @param array params
	*/
	public static function handshake($params){
		$auth=(isset($params['auth']))?$params['auth']:false;
		$user=(isset($params['user']))?$params['user']:false;
		$time=(isset($params['timestamp']))?$params['timestamp']:false;
		$now=time();
		if($now-$time>(10*60)){
			echo("<root>
	<error code='400'>timestamp is more then 10 minutes old</error>
</root>");
		}
		if($auth and $user and $time){
			$query=OC_DB::prepare("SELECT user_id, user_password_sha256 from *PREFIX*media_users WHERE user_id=?");
			$users=$query->execute(array($user))->fetchAll();
			if(count($users)>0){
				$pass=$users[0]['user_password_sha256'];
				$key=hash('sha256',$time.$pass);
				if($key==$auth){
					$token=hash('sha256','oc_media_'.$key);
					OC_MEDIA_COLLECTION::$uid=$users[0]['user_id'];
					$date=date('c');//todo proper update/add/clean dates
					$songs=OC_MEDIA_COLLECTION::getSongCount();
					$artists=OC_MEDIA_COLLECTION::getArtistCount();
					$albums=OC_MEDIA_COLLECTION::getAlbumCount();
					$query=OC_DB::prepare("INSERT INTO *PREFIX*media_sessions (`session_id`, `token`, `user_id`, `start`) VALUES (NULL, ?, ?, now());");
					$query->execute(array($token,$user));
					$expire=date('c',time()+600);
					echo("<root>
	<auth>$token</auth>
	<version>350001</version>
	<update>$date</update>
	<add>$date</add>
	<clean>$date</clean>
	<songs>$songs</songs>
	<artists>$artists</artists>
	<albums>$albums</albums>\
	<session_length>600</session_length>
	<session_expire>$expire</session_expire>
	<tags>0</tags>
	<videos>0</videos>
</root>");
					return;
				}
			}
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
		}else{
			echo("<root>
	<error code='400'>Missing arguments</error>
</root>");
		}
	}

	public static function ping($params){
		if(isset($params['auth'])){
			if(self::checkAuth($params['auth'])){
				self::updateAuth($params['auth']);
			}else{
				echo("<root>
	<error code='400'>Invalid login</error>
</root>");
				return;
			}
		}
		echo('<root>');
		echo('<version>350001</version>');
		echo('</root>');
	}

	public static function checkAuth($auth){
		if(is_array($auth)){
			if(isset($auth['auth'])){
				$auth=$auth['auth'];
			}else{
				return false;
			}
		}
		//remove old sessions
		$query=OC_DB::prepare("DELETE from *PREFIX*media_sessions WHERE start<(NOW()-600)");
		$query->execute();

		$query=OC_DB::prepare("SELECT user_id from *PREFIX*media_sessions WHERE token=?");
		$users=$query->execute(array($auth))->fetchAll();
		if(count($users)>0){
			OC_MEDIA_COLLECTION::$uid=$users[0]['user_id'];
			return $users[0]['user_id'];
		}else{
			return false;
		}
	}

	public static function updateAuth($auth){
		$query=OC_DB::prepare("UPDATE *PREFIX*media_sessions SET start=CURRENT_TIMESTAMP WHERE token=?");
		$query->execute(array($auth));
	}

	private static function printArtist($artist){
		$albums=count(OC_MEDIA_COLLECTION::getAlbums($artist['artist_id']));
		$songs=count(OC_MEDIA_COLLECTION::getSongs($artist['artist_id']));
		$id=$artist['artist_id'];
		$name=utf8_decode(htmlentities($artist['artist_name']));
		echo("\t<artist id='$id'>\n");
		echo("\t\t<name>$name</name>\n");
		echo("\t\t<albums>$albums</albums>\n");
		echo("\t\t<songs>$songs</songs>\n");
		echo("\t\t<rating>0</rating>\n");
		echo("\t\t<preciserating>0</preciserating>\n");
		echo("\t</artist>\n");
	}

	private static function printAlbum($album,$artistName=false){
		if(!$artistName){
			$artistName=OC_MEDIA_COLLECTION::getArtistName($album['album_artist']);
		}
		$artistName=utf8_decode(htmlentities($artistName));
		$songs=count(OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id']));
		$id=$album['album_id'];
		$name=utf8_decode(htmlentities($album['album_name']));
		$artist=$album['album_artist'];
		echo("\t<album id='$id'>\n");
		echo("\t\t<name>$name</name>\n");
		echo("\t\t<artist id='$artist'>$artistName</artist>\n");
		echo("\t\t<tracks>$songs</tracks>\n");
		echo("\t\t<rating>0</rating>\n");
		echo("\t\t<preciserating>0</preciserating>\n");
		echo("\t</album>\n");
	}

	private static function printSong($song,$artistName=false,$albumName=false){
		if(!$artistName){
			$artistName=OC_MEDIA_COLLECTION::getArtistName($song['song_artist']);
		}
		if(!$albumName){
			$albumName=OC_MEDIA_COLLECTION::getAlbumName($song['song_album']);
		}
		$artistName=utf8_decode(htmlentities($artistName));
		$albumName=utf8_decode(htmlentities($albumName));
		$id=$song['song_id'];
		$name=utf8_decode(htmlentities($song['song_name']));
		$artist=$song['song_artist'];
		$album=$song['song_album'];
		echo("\t<song id='$id'>\n");
		echo("\t\t<title>$name</title>\n");
		echo("\t\t<artist id='$artist'>$artistName</artist>\n");
		echo("\t\t<album id='$album'>$albumName</album>\n");
		$url=OC_Helper::linkTo('media', 'server/xml.server.php', null, true)."?action=play&song=$id&auth={$_GET['auth']}";
		$url=htmlentities($url);
		echo("\t\t<url>$url</url>\n");
		echo("\t\t<time>{$song['song_length']}</time>\n");
		echo("\t\t<track>{$song['song_track']}</track>\n");
		echo("\t\t<size>{$song['song_size']}</size>\n");
		echo("\t\t<art></art>\n");
		echo("\t\t<rating>0</rating>\n");
		echo("\t\t<preciserating>0</preciserating>\n");
		echo("\t</song>\n");
	}

	public static function artists($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$filter=isset($params['filter'])?$params['filter']:'';
		$exact=isset($params['exact'])?($params['exact']=='true'):false;
		$artists=OC_MEDIA_COLLECTION::getArtists($filter,$exact);
		if(defined("DEBUG") && DEBUG) {error_log('artists found: '.print_r($artists,true));}
		echo('<root>');
		foreach($artists as $artist){
			self::printArtist($artist);
		}
		echo('</root>');
	}

	public static function artist_songs($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$filter=isset($params['filter'])?$params['filter']:'';
		$songs=OC_MEDIA_COLLECTION::getSongs($filter);
		$artist=OC_MEDIA_COLLECTION::getArtistName($filter);
		echo('<root>');
		foreach($songs as $song){
			self::printSong($song,$artist);
		}
		echo('</root>');
	}

	public static function artist_albums($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		global $SITEROOT;
		$filter=$params['filter'];
		$albums=OC_MEDIA_COLLECTION::getAlbums($filter);
		$artist=OC_MEDIA_COLLECTION::getArtistName($filter);
		echo('<root>');
		foreach($albums as $album){
			self::printAlbum($album,$artist);
		}
		echo('</root>');
	}

	public static function albums($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$filter=isset($params['filter'])?$params['filter']:'';
		$exact=isset($params['exact'])?($params['exact']=='true'):false;
		$albums=OC_MEDIA_COLLECTION::getAlbums(0,$filter,$exact);
		echo('<root>');
		foreach($albums as $album){
			self::printAlbum($album,$artist);
		}
		echo('</root>');
	}

	public static function album_songs($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$songs=OC_MEDIA_COLLECTION::getSongs(0,$params['filter']);
		if(count($songs)>0){
			$artist=OC_MEDIA_COLLECTION::getArtistName($songs[0]['song_artist']);
		}
		echo('<root>');
		foreach($songs as $song){
			self::printSong($song,$artist);
		}
		echo('</root>');
	}

	public static function songs($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$filter=isset($params['filter'])?$params['filter']:'';
		$exact=isset($params['exact'])?($params['exact']=='true'):false;
		$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$filter,$exact);
		echo('<root>');
		foreach($songs as $song){
			self::printSong($song);
		}
		echo('</root>');
	}

	public static function song($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		if($song=OC_MEDIA_COLLECTION::getSong($params['filter'])){
			echo('<root>');
			self::printSong($song);
			echo('</root>');
		}
	}

	public static function play($params){
		$username=!self::checkAuth($params);
		if($username){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		if($song=OC_MEDIA_COLLECTION::getSong($params['song'])){
			OC_Util::setupFS($song["song_user"]);

			header('Content-type: '.OC_Filesystem::getMimeType($song['song_path']));
			header('Content-Length: '.$song['song_size']);
			OC_Filesystem::readfile($song['song_path']);
		}
	}

	public static function url_to_song($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$url=$params['url'];
		$songId=substr($url,strrpos($url,'song=')+5);
		if($song=OC_MEDIA_COLLECTION::getSong($songId)){
			echo('<root>');
			self::printSong($song);
			echo('</root>');
		}
	}

	public static function search_songs($params){
		if(!self::checkAuth($params)){
			echo("<root>
	<error code='400'>Invalid login</error>
</root>");
			return;
		}
		$filter=$params['filter'];
		$artists=OC_MEDIA_COLLECTION::getArtists($filter);
		$albums=OC_MEDIA_COLLECTION::getAlbums(0,$filter);
		$songs=OC_MEDIA_COLLECTION::getSongs(0,0,$filter);
		foreach($artists as $artist){
			$songs=array_merge($songs,OC_MEDIA_COLLECTION::getSongs($artist['artist_id']));
		}
		foreach($albums as $album){
			$songs=array_merge($songs,OC_MEDIA_COLLECTION::getSongs($album['album_artist'],$album['album_id']));
		}
		echo('<root>');
		foreach($songs as $song){
			self::printSong($song);
		}
		echo('</root>');
	}
}

?>


text:
YScript/YogaScript is a JS script that has been hooked up into a styled Html5 document that allows the world to record how many girls you see wearing yoga pants!

Changelog

```
Version 1.0.0
This is the initial version of YScript!

Version 1.0.1
- Added the Background Colour and Imported the Google Font
- Wrote the Initial JavaScript Engine behind YScript

Version 1.2
- Wrote the Coffee Script for YScript
- Added A Button, When taps +1's the count of girls
you've seen wearing yoga pants that day.

Version 1.0.3 to 1.0.9
- Moved CSS to its own file [style.css]
- Refactored index.html
- Refactored script.js

Version 1.2.6
- Over the last few versions. Version 1.2.0 to 1.2.6 I have
fixed a major problem involving stability. [JS Files]
- Patched the Heartbleed Bug (JK LOL)

Version 1.2.7
- Added a Graphic to the home page.
- Setup the project for further updates. I have some great ideas!

Version 2.0 *** MAJOR UPDATE ***
- We have redesigned Yoga Script to run on Bootstrap.framework!
- Cleaned up our Script.js and Script.coffee files.
- New Background Colour. #CC0033
- Improved Performance of +1 Button.
```
License
=============
Copyright (c) 2014 Douglas Bumby

Commits made by Douglas Bumby. Twitter: @istx25


text:
import Ember from 'ember';
import { initialize } from '../../../initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';

var container, application;

module('<%= classifiedModuleName %>Initializer', {
  beforeEach: function() {
    Ember.run(function() {
      application = Ember.Application.create();
      container = application.__container__;
      application.deferReadiness();
    });
  }
});

// Replace this with your real tests.
test('it works', function(assert) {
  initialize(container, application);

  // you would normally confirm the results of the initializer here
  assert.ok(true);
});


text:
I18n_data_en = {
  "brand"                         : "METEOR SHINE",

  "title_home"                    : "Home",
  "title_blogs"                   : "Blogs",
  "title_my_blogs"                : "My Blogs",
  "title_blog_new"                : "New Blog",
  "title_blog_edit"               : "Edit Blog",
  "title_comments"                : "Comments",
  "title_notifications"           : "Notifications",
  "title_preference"              : "Preference",
  "title_mail_reset_password"     : "Password Reset",
  "title_reset_password"          : "Password Reset",
  "title_mail_verify_email"       : "Welcome to Brandname",
  "title_verify_email"            : "Email Title here",
  "title_user_list"               : "User List",
  "title_new_message"             : "New Message",
  "title_profile"                 : "Profile",
  "title_profile_edit_picture"    : "Edit picture",

  "command_sign_in"               : "Sign in",
  "command_sign_out"              : "Sign out",
  "command_sign_up"               : "Sign up",
  "command_new"                   : "New",
  "command_register"              : "Register",
  "command_edit"                  : "Edit",
  "command_update"                : "Update",
  "command_remove"                : "Remove",
  "command_save"                  : "Save",
  "command_ok"                    : "Ok",
  "command_publish"               : "Publish",
  "command_cancel"                : "Cancel",
  "command_back"                  : "Back",
  "command_close"                 : "Close",
  "command_load_more"             : "Load more",

  "label_title"                   : "Title",
  "label_content"                 : "Content",
  "label_theme"                   : "Theme",
  "label_phone"                   : "Phone",
  "label_address"                 : "Address",
  "label_terms_of_use"            : "Terms of Use",
  "label_privacy_policy"          : "Privacy Policy",
  "label_connect_us"              : "Connect with us",
  "label_contact_info"            : "Contact Information",
  "label_unsubscribe"             : "Unsubscription",
  "label_profile_picture"         : "Picture",
  "label_profile_personal_info"   : "Personal information",
  "label_new_post"                : "Write",
  "label_edit_post"               : "Edit",

  "text_notification_new_comment" : "A new comment registered for {0}'s blog",
  "text_no_blogs"                 : "There is no blog registered.",
  "text_company_phone"            : "Company Phone Number",
  "text_company_address"          : "Company Address",
  "text_reset_password"           : "Password Reset",
  "text_verify_email"             : "You just signed up. Click this link to validate your email address : ",
  "text_post_insert_success"      : "Post published",
  "text_post_update_success"      : "Post updated",
  "text_post_remove_success"      : "Post removed",
  "text_draft_inserted"           : "Draft saved",
  "text_draft_updated"            : "Draft updated",
  "text_draft_removed"            : "Draft removed",
  "text_post_draft_success"       : "Post draft saved",
  "text_notifications_empty"      : "There's no notification.",
  "text_user_count"               : "User count: {0}",

  "text_room_insert_success"      : "Room created",

  "error_access_denied"           : "Access denied",
  "error_invalid_type"            : "Input data type is invalid",
  "error_input_required"          : "Input value is required",
  "error_input_out_of_range"      : "Input value is out of range",
  "error_validation_errors"       : "Error in validataion",

  "theme"                         : {
    "default"                       : "Default",
    "cerulean"                      : "Cerulean",
    "cosmo"                         : "Cosmo",
    "cyborg"                        : "Cyborg",
    "darkly"                        : "Darkly",
    "flatly"                        : "Flatly",
    "journal"                       : "Journal",
    "lumen"                         : "Lumen",
    "paper"                         : "Paper",
    "readable"                      : "Readable",
    "sandstone"                     : "Sandstone",
    "simplex"                       : "Simplex",
    "slate"                         : "Slate",
    "spacelab"                      : "Spacelab",
    "superhero"                     : "Superhero",
    "united"                        : "United",
    "yeti"                          : "Yeti"
  }
};


text:
using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace com.esendex.sdk.contacts
{
    /// <summary>
    /// Represents a contact.
    /// </summary>
    [Serializable]
    [XmlRoot("contact", Namespace = Constants.API_NAMESPACE)]
    public class Contact : ModelBase
    {
        /// <summary>
        /// Initialises a new instance of the com.esendex.sdk.contacts.Contact
        /// </summary>
        /// <param name="quickName">A System.String instance that contains the quick name.</param>
        /// <param name="phoneNumber">A System.String instance that contains the phone number.</param>
        /// <exception cref="System.ArgumentNullException"></exception>
        public Contact(string quickName, string phoneNumber)
            : this()
        {
            if (string.IsNullOrEmpty(quickName)) throw new ArgumentNullException("quickName");
            if (string.IsNullOrEmpty(phoneNumber)) throw new ArgumentNullException("phoneNumber");

            QuickName = quickName;
            PhoneNumber = phoneNumber;
        }

        /// <summary>
        /// Initialises a new instance of the com.esendex.sdk.contacts.Contact
        /// </summary>
        public Contact()
        {
            Groups = new List<ContactGroupSummary>();
        }

        /// <summary>
        /// Gets or sets the Concurrency Id.
        /// </summary>
        [XmlElement("concurrencyid")]
        public Guid ConcurrencyId { get; set; }
        public bool ShouldSerializeConcurrencyId() { return ConcurrencyId != Guid.Empty; }

        /// <summary>
        /// Gets or sets the first name.
        /// </summary>
        [XmlElement("firstname")]
        public string FirstName { get; set; }

        /// <summary>
        /// Gets or sets the last name.
        /// </summary>
        [XmlElement("lastname")]
        public string LastName { get; set; }

        /// <summary>
        /// Gets or sets the quick name.
        /// </summary>
        [XmlElement("quickname")]
        public string QuickName { get; set; }

        /// <summary>
        /// Gets or sets the mobile number.
        /// </summary>
        [XmlElement("mobilenumber")]
        public string PhoneNumber { get; set; }

        /// <summary>
        /// Gets or sets the contact type.
        /// </summary>
        [XmlElement("type")]
        public ContactType Type { get; set; }

        /// <summary>
        /// Gets or sets the contact group summary.
        /// </summary>
        [XmlArray("groups")]
        [XmlArrayItem("groupsummary")]
        public List<ContactGroupSummary> Groups { get; set; }
        public bool ShouldSerializeGroups() { return Groups.Count > 0; }

        /// <summary>
        /// Determines whether the specified System.Object are considered equal.
        /// </summary>
        /// <param name="obj">The System.Object to compare with the current System.Object</param>
        /// <returns>true if the specified System.Object is equal to the current System.Object; otherwise, false.</returns>
        public override bool Equals(object obj)
        {
            Contact other = obj as Contact;

            if (other == null) return false;

            if (ConcurrencyId != other.ConcurrencyId) return false;
            if (FirstName !=  other.FirstName) return false;
            if (LastName !=  other.LastName) return false;
            if (QuickName !=  other.QuickName) return false;
            if (PhoneNumber != other.PhoneNumber) return false;

            for (int i = 0; i < this.Groups.Count; i++)
            {
                if (Groups[i] != other.Groups[i]) return false;
            }

            return base.Equals(obj);
        }

        /// <summary>
        /// Serves as a hash function for a particular type.
        /// </summary>
        /// <returns>A hash code for the current System.Object</returns>
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <title>Testing</title>
    <link rel="stylesheet" href="libraries/leaflet/leaflet.css" />


text:
import mongoose from 'mongoose';
mongoose.Promise = require('bluebird');
import { userSchema } from './UserModel';
const connection = mongoose.createConnection('mongodb://localhost:27017/reactapp_test');
const User = connection.model('User', userSchema);

import { describe, it, beforeEach, afterEach } from 'mocha';
import { expect } from 'chai';

describe('model', function() {
  beforeEach(function(done) {
    // remove entries from db
    connection.db.dropDatabase(function(error, result) {
      if (error) {
        // console.log('beforeEach error:', error);
        return done();
      }
      // console.log('beforeEach result:', result);
      done();
    });
  });

  // afterEach(function(done) {
  //   // populate db seed
  //   User.create({ email: 'hello@world.com', password: '123456', role: 'user' }, function(error, user) {
  //     if (error) {
  //       return done();
  //     }
  //     done();
  //   });
  // });

  describe('User', () => {
    it("should have a valid indexes", function() {
      const indexes = User.schema.indexes();
      // console.log(indexes);
    });

    it("should have a valid 'admin' virtual property", function(done) {
      User.create({ email: 'user3@email.com', password: '123456', role: 'user' }, function(error, user) {
        expect(user.admin).to.equal(false);
        done();
      });
    });

    it("should have a valid 'products' virtual property", function(done) {
      User.create({ email: 'user3@email.com', password: '123456', role: 'user' }, function(error, user) {
        User.populate(user, { path: 'products' }, function(error, user) {
          expect(user.products).to.deep.equal([]);
          done();
        });
      });
    });

    it("should convert the password into hash on User create", function(done) {
      User.create({ email: 'user1@email.com', password: '123456', role: 'user' }, function(error, user) {
        expect(user.password).to.not.equal('123456');
        done();
      });
    });

    it("should have a 'validPassword' instance method", function(done) {
      this.timeout(5000);

      User.create({ email: 'user2@email.com', password: '123456', role: 'user' }, function(error, user) {
        expect(user.validPassword('123456')).to.equal(true);
        expect(user.validPassword('789012')).to.equal(false);
        done();
      });
    });

    // TODO
    // it("should not create a user when email is already exist", function(done) {
    //   User.create({ email: 'hello@world.com', password: 'abcdef', role: 'user' }, function(error, user) {
    //     if (error) {
    //       console.log('error', error);
    //       throw Error(error);
    //     }
    //     console.log('user created:', user);
    //
    //     User.create({ email: 'hello@world.com', password: 'abcdef', role: 'user' }, function(error, user) {
    //       if (error) {
    //         console.log('error', error);
    //         throw Error(error);
    //       }
    //       console.log('user re-created:', user);
    //
    //       done();
    //     });
    //   });
    // });
  });
});


text:
require 'spec_helper'

feature 'as entry manager, managing user roles' do
  context 'via entry show page' do
    scenario 'giving a member on the account of entry permissions on that entry' do
      entry = create(:entry)
      create(:user, :member, on: entry.account)
      Dom::Admin::Page.sign_in_as(:manager, on: entry)

      visit(admin_entry_path(entry))

      Dom::Admin::EntryPage.first.add_member_link.click
      Dom::Admin::MembershipForm.first.submit_with(role: 'publisher',
                                                   entity: entry)
      expect(Dom::Admin::EntryPage.first).to have_role_flag('publisher')
    end

    scenario 'editing permissions of a user on an entry' do
      entry = create(:entry)
      create(:user, :previewer, on: entry)
      Dom::Admin::Page.sign_in_as(:manager, on: entry)

      visit(admin_entry_path(entry))

      Dom::Admin::EntryPage.first.edit_role_link('previewer').click
      Dom::Admin::MembershipForm.first.submit_with(role: 'publisher')
      expect(Dom::Admin::EntryPage.first).to have_role_flag('publisher')
    end

    scenario 'deleting permissions of a user on an entry' do
      entry = create(:entry)
      create(:user, :previewer, on: entry)
      Dom::Admin::Page.sign_in_as(:manager, on: entry)

      visit(admin_entry_path(entry))

      Dom::Admin::EntryPage.first.delete_member_link('previewer').click

      expect(Dom::Admin::EntryPage.first).not_to have_role_flag('previewer')
    end
  end
end


text:
using System.Reflection;

namespace Greatbone.Web
{
    /// <summary>
    /// A web handling target.
    /// </summary>
    public abstract class WebTarget : IKeyable<string>
    {
        // uri segment
        readonly string name;

        // name in lowercase
        readonly string lower;

        readonly string label;

        readonly string tip;

        readonly byte sort;

        // permission check
        internal readonly AuthorizeAttribute authorize;

        internal readonly AuthorizeException exception;

        internal WebTarget(string name, ICustomAttributeProvider attrp, UiAttribute ui = null, AuthorizeAttribute authorize = null)
        {
            this.name = name ?? throw new WebException("null target name");
            this.lower = name.ToLower();

            // either methodinfo or typeinfo
            if (attrp == null)
            {
                attrp = GetType().GetTypeInfo();
            }

            if (ui == null)
            {
                var uis = (UiAttribute[]) attrp.GetCustomAttributes(typeof(UiAttribute), true);
                if (uis.Length > 0) ui = uis[0];
            }
            label = ui?.Label;
            tip = ui?.Tip ?? label;
            sort = ui?.Sort ?? 0;

            if (authorize == null)
            {
                var aas = (AuthorizeAttribute[]) attrp.GetCustomAttributes(typeof(AuthorizeAttribute), true);
                if (aas.Length > 0)
                {
                    authorize = aas[0];
                }
            }
            if (authorize != null)
            {
                this.authorize = authorize;
            }
            exception = new AuthorizeException(this, authorize);
        }

        public virtual string Key => name;

        public string Lower => lower;

        public string Label => label;

        public string Tip => tip;

        public byte Sort => sort;

        public bool DoAuthorize(WebContext wc)
        {
            if (authorize != null)
            {
                // check if trusted peer
                if (wc.CallerSign != null && wc.CallerSign == App.Sign)
                {
                    return true; // trusted without further check
                }
                return authorize.Do(wc);
            }
            return true;
        }

        public override string ToString()
        {
            return name;
        }
    }
}