text:
<!DOCTYPE html>

    <meta content="noindex,nofollow" name="robots">
    <meta charset="utf-8">
    <title>Formtastic</title>

    <link href="/formtastic.css" rel="stylesheet" type="text/css" />

Formtastic

  <form action="basic_inputs.html" class="formtastic gem" id="new_gem" method="get">
    <fieldset class="inputs">

          Summary
          <input id="gem_summary" name="gem[summary]" type="text" value="A Rails form builder plugin/gem with semantically rich and accessible markup" maxlength="255">

          Description
          <textarea id="gem_description" rows="5">A Rails form builder plugin/gem with semantically rich and accessible markup</textarea>

          URL
          <input id="gem_url" name="gem[url]" type="url">

Example: https://github.com/justinfrench/formtastic

          Password*
          <input id="gem_password" name="gem[password]" type="password">

can't be blank

          Password confirmation*
          <input id="gem_password_confirmation" name="gem[password_confirmation]" type="password">

can't be blank

          Downloads
          <input id="gem_downloads" name="gem[downloads]" type="numeric" value="209,354">

          File
          <input id="gem_file" name="gem[file]" type="file" value="value">

          Email
          <input id="gem_email" name="gem[email]" type="email">

          Phone
          <input id="gem_phone" name="gem[phone]" type="phone">

          Search
          <input id="gem_search" name="gem[search]" type="search">

          <fieldset class="fragments">
            <legend class="label">First release</legend>

                Year
                <select id="gem_first_release_1i" name="gem[first_release][1i]">
                  <option>2009</option>
                </select>

                Month
                <select id="gem_first_release_2i" name="gem[first_release][2i]">
                  <option>October</option>
                </select>

                Day
                <select id="gem_first_release_3i" name="gem[first_release][3i]">
                  <option>15</option>
                </select>

          </fieldset>

          Autofocus
          <input id="gem_autofocus" name="gem[autofocus]" type="text" value="The focus is set to this field" autofocus="autofocus">

            <input id="gem_terms_and_conditions" name="gem[terms_and_conditions]" type="checkbox" value="1" checked="checked">
            I agree to your draconian terms of service even though I didn't read them

          Select
          <select id="gem_awesomeness" name="gem[awesomeness]">
            <option value="5">First choice</option>
            <option value="4">Second choice</option>
          </select>

          <fieldset class="choices">
            <legend class="label">Rate</legend>

                <input id="gem_rate_five" name="gem[rate]" type="radio" checked="checked"> Five

                <input id="gem_rate_four" name="gem[rate]" type="radio"> Four

                <input id="gem_rate_three" name="gem[rate]" type="radio"> Three

                <input id="gem_rate_two" name="gem[rate]" type="radio"> Two

                <input id="gem_rate_one" name="gem[rate]" type="radio"> One

          </fieldset>

          <fieldset class="choices">
            <legend class="label">Browsers</legend>

                <input id="gem_browser_google_chrome" name="gem[browser][]" type="checkbox"> Google Chrome

                <input id="gem_browser_apple_safari" name="gem[browser][]" type="checkbox"> Apple Safari

                <input id="gem_browser_mozilla_firefox" name="gem[browser][]" type="checkbox"> Mozilla Firefox

                <input id="gem_browser_opera" name="gem[browser][]" type="checkbox"> Opera

                <input id="gem_browser_internet_explorer" name="gem[browser][]" type="checkbox"> Internet Explorer (Although you really can't call it a browser can you? This is some long text to force wrapping.)

          </fieldset>

    </fieldset>

    <fieldset class="buttons">

          <input class="create" id="gem_submit" type="submit">

    </fieldset>
  </form>


text:
use std::collections::{HashMap, HashSet};

use super::FactionId;
use engine::components::Color;

use scaii_defs::protos::{Action, State, Viz};

use specs::prelude::*;

pub mod collision;
mod unit_type;

pub use self::{collision::*, unit_type::*};
pub use engine::systems::lua::userdata::DataStore;

// Recommended by ncollide
pub const COLLISION_MARGIN: f64 = 0.02;
// ncollide wants the average size of a collider to be "around" 1
// we should probably set this as a resource from Lua in the future
pub const COLLISION_SCALE: f64 = 5.0;

pub const UNIVERSAL_SENSOR: usize = SENSOR_OFFSET + MAX_FACTIONS;
pub const SENSOR_OFFSET: usize = MAX_FACTIONS;
pub const SENSOR_BLACKLIST: [usize; MAX_FACTIONS + 1] = [
    SENSOR_OFFSET,
    SENSOR_OFFSET + 1,
    SENSOR_OFFSET + 2,
    SENSOR_OFFSET + 3,
    UNIVERSAL_SENSOR,
];

pub const MAX_FACTIONS: usize = 4;

pub const STATE_SIZE: usize = 40;
pub const STATE_SCALE: usize = 1;

lazy_static! {
    pub static ref PLAYER_COLORS: Vec<Color> = vec![
        Color {
            r: 255,
            g: 181,
            b: 0,
        },
        Color { r: 255, g: 0, b: 0 },
        Color { r: 0, g: 0, b: 255 },
    ];
}

// 60FPS emulation since we're not
// actually measuring time elapsed
const SIXTY_FPS: f64 = 1.0 / 60.0;

pub(super) fn register_world_resources(world: &mut World) {
    use ndarray::Array3;
    use specs::saveload::U64MarkerAllocator;
    use util;

    let rng = util::make_rng();
    world.add_resource(rng);
    world.add_resource(Episode(0));
    world.add_resource(Terminal(false));
    world.add_resource(Step(0));
    world.add_resource(MaxStep(None));
    world.add_resource(DeltaT(SIXTY_FPS));
    world.add_resource(Render::default());
    world.add_resource(NeedsKeyInfo(true));
    world.add_resource::<Vec<Player>>(Vec::new());
    world.add_resource(UnitTypeMap::default());
    world.add_resource(U64MarkerAllocator::new());
    world.add_resource(ActionInput::default());
    world.add_resource(new_collision_world());

    world.add_resource(RtsState(State {
        features: Array3::zeros([STATE_SIZE, STATE_SIZE, 4]).into_raw_vec(),
        feature_array_dims: vec![STATE_SIZE as u32, STATE_SIZE as u32, 4],
        ..Default::default()
    }));

    world.add_resource(Reward::default());
    world.add_resource(Skip(false, None));
    world.add_resource(SerializeBytes::default());
    world.add_resource(LuaPath(None));
    world.add_resource(ReplayMode(false));
    world.add_resource(RewardTypes::default());
    world.add_resource(SpawnBuffer::default());
    world.add_resource(Deserializing(false));
    world.add_resource(CumReward::default());
    world.add_resource(DataStore::default());
}

#[derive(Default, Debug, Clone, PartialEq)]
pub struct RtsState(pub State);

/// The current episode, only meaningful for sequential runs.
#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub struct Episode(pub usize);

#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub struct Step(pub usize);

#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub struct MaxStep(pub Option<usize>);

/// Is this the final frame of the scenario?
#[derive(Copy, Clone, PartialEq, Eq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
pub struct Terminal(pub bool);

/// Time since the last update, in seconds (fixed to one sixtieth of a second for our purposes).
#[derive(Copy, Clone, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct DeltaT(pub f64);

/// Any associated data with various game factions.
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct Player {
    pub color: super::components::Color,
    pub id: FactionId,
}

/// The output of the renderer, for use with Viz.
#[derive(Clone, PartialEq, Default)]
pub struct Render(pub Viz);

/// Tracks whether a FULL rerender (or total state, or whatever else)
/// is needed rather than a delta.
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Default, Debug)]
pub struct NeedsKeyInfo(pub bool);

/// The actions coming from the Agent (or replay mechanism)
#[derive(Clone, PartialEq, Default, Debug)]
pub struct ActionInput(pub Option<Action>);

#[derive(PartialEq, Default, Clone)]
pub struct Reward(pub HashMap<String, f64>);

#[derive(PartialEq, Default, Clone, Serialize, Deserialize, Debug)]
pub struct CumReward(pub HashMap<String, f64>);

#[derive(Eq, PartialEq, Default, Clone, Debug, Hash)]
pub struct Skip(pub bool, pub Option<String>);

#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub struct SerializeBytes(pub Vec<u8>);

#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub struct LuaPath(pub Option<String>);

#[derive(Copy, Clone, Eq, PartialEq, Default)]
pub struct ReplayMode(pub bool);

#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug)]
pub struct RewardTypes(pub HashSet<String>);

impl Default for RewardTypes {
    fn default() -> Self {
        let mut map = HashSet::new();
        map.insert("death".to_string());
        map.insert("kill".to_string());
        map.insert("dmg_dealt".to_string());
        map.insert("dmg_recvd".to_string());
        map.insert("victory".to_string());
        map.insert("defeat".to_string());

        RewardTypes(map)
    }
}

#[derive(Clone, PartialEq, Debug, Serialize, Deserialize)]
pub struct Spawn {
    pub delay: u64,
    pub pos: super::components::Pos,
    pub curr_hp: Option<f64>,
    pub faction: usize,
    pub u_type: String,
}

#[derive(Clone, PartialEq, Debug, Default, Serialize, Deserialize)]
pub struct SpawnBuffer(pub Vec<Spawn>);

#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)]
pub struct Deserializing(pub bool);

redpajama_set_name: RedPajamaGithub


text:
title: "Installing Apple's Java in Mavericks"
layout: "post"
permalink: "/2014/01/installing-apples-java-in-mavericks.html"
uuid: "2697416428267019828"
guid: "tag:blogger.com,1999:blog-32090046.post-2697416428267019828"
date: "2014-01-24 20:30:00"
updated: "2014-01-24 20:30:23"
thumbnail: "{{ site.baseurl }}/images/java-mavericks/thumb.png"
description:
blogger:
    siteid: "32090046"
    postid: "2697416428267019828"
    comments: "0"
categories:
author:
    name: "rectalogic"
    url: "undefined?rel=author"
    image: "http://img2.blogblog.com/img/b16-rounded.gif"
---

Mavericks doesn't have Java installed by default. If you try to use the `/usr/bin/java` executable from Terminal, it will pop up a dialog prompting you to visit Oracle's site and download a JDK.

```bash
$ /usr/bin/java
```

![java-oracle.png]({{ site.baseurl }}/images/java-mavericks/java-oracle-s1600.png)

If you want to install Apple's Java instead, then run java from a subshell. This will pop up a dialog prompting you to directly install Apple's JDK.

```bash
$ `/usr/bin/java`
```

![java-apple.png]({{ site.baseurl }}/images/java-mavericks/java-apple-s1600.png)

The Java installer stub `/System/Library/Java/Support/CoreDeploy.bundle/Contents/Download\ Java\ Components.app` appears to check if it was invoked from an interactive TTY or not, and changes behavior accordingly.


text:
A simple library for uni-directional dataflow application architecture... inspired by Flux and Redux

[![npm version](https://badge.fury.io/js/acid-reflux-js.svg)](https://badge.fury.io/js/acid-reflux-js)

See more in depth docs [here](https://sam-g-steel.github.io/acid-reflux-js/)

Example code...

    var acidRefluxJS = require("acid-reflux-js")

    // Create store
    let store = new acidRefluxJS.Store();

    // Subscribe to changes
    store.subscribeToChanges((newState, oldState)=>{
        console.log("on any change", newState)
    });

    store.subscribeToChanges((newVal, oldVal)=>{
        console.log("isLoggedIn changed to...", newVal)
    }, "isLoggedIn");

    // Set time
    store.setState({
        time: Date.now()
    });

    // Set time and isLoggedIn
    store.setState({
        time: Date.now(),
        isLoggedIn: true
    });

    console.log("Full History", store.getFullHistory());

#Latest Changes

**v1.0.0**
Changed build dir from /es5 to /lib
Added improved TypeScript support

**v0.3.2**
Updating docs

**v0.3.1**
Fixed a bug in the TypeScript definition file

**v0.3.0**

Added state mapping
More docs on this later

**v0.2.0**

Added State.maxHistoryLength
Added state binding

**v0.1.7**

Added more docs using ESdoc [wip]

**v0.1.6**

Updated Change Log functions... internal property "__time" is now ignored

Log looks cleaner

**v0.1.5**

Added Change Log functions... More to come in the docs!

**v0.1.4**

Improved changed detection, now if a state property changes from one object to another that is identical, no change is registered

#Future Plans

- More Docs
- State change playback mode


text:
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Create Share Group Snapshot" %}{% endblock %}

{% block main %}
    {% include 'project/share_group_snapshots/_create.html' %}
{% endblock %}


text:
package com.navercorp.pinpoint.profiler.instrument.classloading;

import com.navercorp.pinpoint.common.util.Assert;
import com.navercorp.pinpoint.profiler.instrument.InstrumentEngine;
import com.navercorp.pinpoint.profiler.plugin.PluginConfig;

/**
 * @author Woonduk Kang(emeroad)
 */
public class ClassInjectorFactory {

    private final InstrumentEngine instrumentEngine;
    private final BootstrapCore bootstrapCore;

    public ClassInjectorFactory(InstrumentEngine instrumentEngine, BootstrapCore bootstrapCore) {
        this.instrumentEngine = Assert.requireNonNull(instrumentEngine, "instrumentEngine");
        this.bootstrapCore = Assert.requireNonNull(bootstrapCore, "bootstrapCore");
    }

    public ClassInjector newClassInjector(PluginConfig pluginConfig) {
        return new JarProfilerPluginClassInjector(pluginConfig, instrumentEngine, bootstrapCore);
    }
}


text:
name 'sysctl'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
issues_url 'https://github.com/sous-chefs/sysctl/issues'
source_url 'https://github.com/sous-chefs/sysctl'
license 'Apache-2.0'
description 'Configures sysctl parameters'
version '1.1.0'
chef_version '>= 12.7' if respond_to?(:chef_version)

supports 'amazon'
supports 'ubuntu', '>= 14.04'
supports 'debian', '>= 8.0'
supports 'centos', '>= 6.0'
supports 'scientific', '>= 6.4'
supports 'suse', '>= 11.0'
supports 'opensuseleap'
supports 'redhat'
supports 'pld'

depends 'ohai', '>= 5.0'


text:
#include <re_types.h>
#include <re_mem.h>
#include <re_mbuf.h>
#include <re_list.h>
#include <re_hash.h>
#include <re_tmr.h>
#include <re_sa.h>
#include <re_md5.h>
#include <re_udp.h>
#include <re_stun.h>
#include <re_turn.h>
#include "turnc.h"

enum {
	PERM_LIFETIME = 300,
	PERM_REFRESH = 250,
};

struct perm {
	struct le he;
	struct loop_state ls;
	struct sa peer;
	struct tmr tmr;
	struct turnc *turnc;
	struct stun_ctrans *ct;
	turnc_perm_h *ph;
	void *arg;
};

static int createperm_request(struct perm *perm, bool reset_ls);

static void destructor(void *arg)
{
	struct perm *perm = arg;

	tmr_cancel(&perm->tmr);
	mem_deref(perm->ct);
	hash_unlink(&perm->he);
}

static bool hash_cmp_handler(struct le *le, void *arg)
{
	const struct perm *perm = le->data;

	return sa_cmp(&perm->peer, arg, SA_ADDR);
}

static struct perm *perm_find(const struct turnc *turnc, const struct sa *peer)
{
	return list_ledata(hash_lookup(turnc->perms, sa_hash(peer, SA_ADDR),
				       hash_cmp_handler, (void *)peer));
}

static void timeout(void *arg)
{
	struct perm *perm = arg;
	int err;

	err = createperm_request(perm, true);
	if (err)
		perm->turnc->th(err, 0, NULL, NULL, NULL, NULL,
				perm->turnc->arg);
}

static void createperm_resp_handler(int err, uint16_t scode,
				    const char *reason,
				    const struct stun_msg *msg, void *arg)
{
	struct perm *perm = arg;

	if (err || turnc_request_loops(&perm->ls, scode))
		goto out;

	switch (scode) {

	case 0:
		tmr_start(&perm->tmr, PERM_REFRESH * 1000, timeout, perm);
		if (perm->ph) {
			perm->ph(perm->arg);
			perm->ph  = NULL;
			perm->arg = NULL;
		}
		return;

	case 401:
	case 438:
		err = turnc_keygen(perm->turnc, msg);
		if (err)
			break;

		err = createperm_request(perm, false);
		if (err)
			break;

		return;

	default:
		break;
	}

 out:
	perm->turnc->th(err, scode, reason, NULL, NULL, msg, perm->turnc->arg);
}

static int createperm_request(struct perm *perm, bool reset_ls)
{
	struct turnc *t = perm->turnc;

	if (reset_ls)
		turnc_loopstate_reset(&perm->ls);

	return stun_request(&perm->ct, t->stun, t->proto, t->sock, &t->srv, 0,
			    STUN_METHOD_CREATEPERM,
			    t->realm ? t->md5_hash : NULL, sizeof(t->md5_hash),
			    false, createperm_resp_handler, perm, 5,
			    STUN_ATTR_XOR_PEER_ADDR, &perm->peer,
			    STUN_ATTR_USERNAME, t->realm ? t->username : NULL,
			    STUN_ATTR_REALM, t->realm,
			    STUN_ATTR_NONCE, t->nonce,
			    STUN_ATTR_SOFTWARE, stun_software);
}

/**
 * Add TURN Permission for a peer
 *
 * @param turnc TURN Client
 * @param peer  Peer IP-address
 * @param ph    Permission handler
 * @param arg   Handler argument
 *
 * @return 0 if success, otherwise errorcode
 */
int turnc_add_perm(struct turnc *turnc, const struct sa *peer,
		   turnc_perm_h *ph, void *arg)
{
	struct perm *perm;
	int err;

	if (!turnc || !peer)
		return EINVAL;

	if (perm_find(turnc, peer))
		return 0;

	perm = mem_zalloc(sizeof(*perm), destructor);
	if (!perm)
		return ENOMEM;

	hash_append(turnc->perms, sa_hash(peer, SA_ADDR), &perm->he, perm);
	tmr_init(&perm->tmr);
	perm->peer = *peer;
	perm->turnc = turnc;
	perm->ph = ph;
	perm->arg = arg;

	err = createperm_request(perm, true);
	if (err)
		mem_deref(perm);

	return err;
}

int turnc_perm_hash_alloc(struct hash **ht, uint32_t bsize)
{
	return hash_alloc(ht, bsize);
}


text:
define(['dispatcher', 'drop-down/drop-down.store'], function(dispatcher, store) {

	"use strict";

	var items = {}

	//!!!replace if setting data-attribute!
	var idName = 'drop-down-control-id-';
	var idNum  = 1;

	var _handleChange = function() {
		var storeData = store.getData();

		var _checkItem = function(item) {
			var id = item.id;

			if (!storeData.items.hasOwnProperty(id)) return;
			item.active = storeData.items[id].active;

			if (item.active) {
				item.element.classList.add('active');
			} else {
				item.element.classList.remove('active');
			}

			if (storeData.items[id].disabled) {
				item.element.classList.add('hidden');
			} else {
				item.element.classList.remove('hidden');
			}
		}

		for (var id in items) {
			if (items.hasOwnProperty(id)) {
				_checkItem(items[id]);
			}
		}
	}

	var _add = function(items, element) {
		var id = element.getAttribute('data-id');
		var active = element.classList.contains('active');

		if (!id) {
			id = idName + idNum;
			idNum++;

			//setAttribute('data-id', id);
		}

		element.addEventListener('click', function() {
			dispatcher.dispatch({
				type: 'drop-down-toggle',
				me:   'drop-down-controls',
				id:   id
			});
		});

		items[id] = {
			id: id,
			element: element,
			active: active
		}
	}

	var _remove = function(items, item) {
		delete items[item.id];
	}

	var _handleMutate = function() {
		var elements;

		var check = function(items, element) {
			var found = false;
			for (var id in items) {
				if (items.hasOwnProperty(id)) {
					if (items[id].element === element) {
						found = true;
						break;
					}
				}
			}
			if (!found) {
				_add(items, element);
			}
		}

		var backCheck = function(items, elements, item) {
			var element = item.element;
			var found   = false;

			for (var i = 0; i < elements.length; i++) {
				if (elements[i] === item.element) {
					found = true;
					break;
				}
			}

			if (!found) {
				_remove(items, item);
			}
		}

		//-------
		elements = document.getElementsByClassName('drop-down-control');
		for (var i = 0; i < elements.length; i++) {
			check(items, elements[i]);
		}
		for (var id in items) {
			if (items.hasOwnProperty(id)) {
				backCheck(items, elements, items[id]);
			}
		}
		//-------
	}

	var init = function() {
		_handleMutate();
		_handleChange();

		store.eventEmitter.subscribe(_handleChange);

		dispatcher.subscribe(function(e) {
			if (e.type === 'mutate') {
				_handleMutate();
				_handleChange();
			}
		});
	}

	return {
		init: init
	}
});


text:
package quasar.impl.datasources

import slamdata.Predef.Option

import quasar.api.SchemaConfig

import scala.concurrent.duration.FiniteDuration

import cats.Contravariant

/** Attempt to discover the schema of a resource. */
trait ResourceSchema[F[_], S <: SchemaConfig, R] {
  def apply(schemaConfig: S, resource: R, timeLimit: FiniteDuration)
      : F[Option[schemaConfig.Schema]]
}

object ResourceSchema {
  implicit def contravariant[F[_], S <: SchemaConfig]: Contravariant[ResourceSchema[F, S, ?]] =
    new Contravariant[ResourceSchema[F, S, ?]] {
      def contramap[A, B](rs: ResourceSchema[F, S, A])(f: B => A): ResourceSchema[F, S, B] =
        new ResourceSchema[F, S, B] {
          def apply(schemaConfig: S, resource: B, timeLimit: FiniteDuration)
              : F[Option[schemaConfig.Schema]] =
            rs(schemaConfig, f(resource), timeLimit)
        }
    }
}


text:
layout: post
title:  "Green-Flame Blade"
date:   2017-3-22
source: SCAG.143
tags: [sorcerer, warlock, wizard, cantrip, evocation]
categories:
- spells
---

**Evocation cantrip**

**Casting Time**: 1 action

**Range**: 5 feet

**Components**: V, M (a weapon)

**Duration**: Instantaneous

As part of the action used to cast this spell, you must make a melee attack with a weapon against one creature within the spell's range, otherwise the spell fails. On a hit, the target suffers the attack's normal effects, and green fire leaps from the target to a different creature of your choice that you can see within 5 feet of it. The second creature takes fire damage equal to your spellcasting modifier.

This spell's damage increases when you reach higher levels. At 5th level, the melee attack deals an extra 1d8 fire damage to the target, and the fire damage to the second creature increases to 1d8 + your spellcasting ability modifier. Both damage rolls increase by 1d8 at 11th level and 17th level.


text:
/* Optional scoped theme for tag-it which mimics the zendesk widget. */
ul.tagit {
 	background-color: #eeeeee;
	border: 1px solid #d4d4d4;
	border-radius: 5px;
	box-shadow: 0 -1px 1px #c6c6c6;
 	color: #424242;
	float: left;
	font: normal 13px Helvetica, "Lucida Grande", Arial, sans-serif;
	padding: 2px 7px;
	width: 74%;
}
ul.tagit li.tagit-choice {
    background: none;
    background-color: #DEE7F8;
    border: 1px solid #CAD8F3;
    border-radius: 6px;
    font-weight: normal;
}
ul.tagit li.tagit-choice .tagit-label:not(a) {
    color: #555;
}
ul.tagit li.tagit-choice a.tagit-close {
    text-decoration: none;
}
ul.tagit li.tagit-choice .tagit-close {
    right: .4em;
}
ul.tagit li.tagit-choice .ui-icon {
    display: none;
}
ul.tagit li.tagit-choice .tagit-close .text-icon {
    color: #777;
    display: inline;
    font-family: arial, sans-serif;
    font-size: 16px;
    line-height: 16px;
}
ul.tagit li.tagit-choice:hover, ul.tagit li.tagit-choice.remove {
    background-color: #bbcef1;
    border-color: #6d95e0;
}
ul.tagit li.tagit-choice a.tagLabel:hover,
ul.tagit li.tagit-choice a.tagit-close .text-icon:hover {
    color: #222;
}
ul.tagit input[type="text"] {
    color: #333333;
    background: none;
}
.ui-widget {
    font-size: 1.1em;
}

/* Forked from a jQuery UI theme, so that we don't require the jQuery UI CSS as a dependency. */
.tagit-autocomplete.ui-autocomplete { position: absolute; cursor: default; }
* html .tagit-autocomplete.ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
.tagit-autocomplete.ui-menu {
    display:block;
    float: left;
    list-style:none;
    margin: 0;
    padding: 2px;
}
.tagit-autocomplete.ui-menu .ui-menu {
    margin-top: -3px;
}
.tagit-autocomplete.ui-menu .ui-menu-item {
    clear: left;
    float: left;
    margin:0;
    padding: 0;
    width: 100%;
}
.tagit-autocomplete.ui-menu .ui-menu-item a {
    display:block;
    line-height:1.5;
    padding:.2em .4em;
    text-decoration:none;
}
.tagit-autocomplete .ui-menu .ui-menu-item a.ui-state-hover,
.tagit-autocomplete .ui-menu .ui-menu-item a.ui-state-active {
    font-weight: normal;
    margin: -1px;
}
.tagit-autocomplete.ui-widget-content {
	background: #ffffff 50% 50% repeat-x;
	border: 1px solid #aaaaaa;
	color: #222222;
}
.tagit-autocomplete.ui-corner-all, .tagit-autocomplete .ui-corner-all {
	border-radius: 4px;
}
.tagit-autocomplete .ui-state-hover, .tagit-autocomplete .ui-state-focus {
	background: #dadada;
	border: 1px solid #999999;
	color: #212121;
	font-weight: normal;
}
.tagit-autocomplete .ui-state-active  {
	border: 1px solid #aaaaaa;
}
.tagit-autocomplete .ui-widget-content {
	border: 1px solid #aaaaaa;
}
.tagit .ui-helper-hidden-accessible {
	clip: rect(1px,1px,1px,1px);
	position: absolute !important;
}


text:
@charset "UTF-8";
/* TOC – Color Variables

- Basics
- Corporate Identity Colorpalette
- Foundation Color Variables
- Grey Scale
- Topbar-Navigation
- Footer
- Code

*/
/* Basics
------------------------------------------------------------------- */
/* Corporate Identity Colorpalette
   https://color.adobe.com/de/Flat-Design-Colors-v2-color-theme-4341903/
------------------------------------------------------------------- */
/* Foundation Color Variables
------------------------------------------------------------------- */
/* Grey Scale
------------------------------------------------------------------- */
/* Topbar-Navigation
------------------------------------------------------------------- */
/* Footer
------------------------------------------------------------------- */
/* Code
------------------------------------------------------------------- */
/* TOC – Typography variables

Modular Scale › http://www.modularscale.com//?16,36&px&1.25&web&table

- Fonts
- Font Weight
- Font Size Variables

*/
/* Fonts
------------------------------------------------------------------- */
/* Font Weight
------------------------------------------------------------------- */
/* Font Size Variables
------------------------------------------------------------------- */
/* line 56, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_02_settings_typography.scss */
.font-size-h1 {
  font-size: 2.441em;
}

/* line 57, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_02_settings_typography.scss */
.font-size-h2 {
  font-size: 1.953em;
}

/* line 58, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_02_settings_typography.scss */
.font-size-h3 {
  font-size: 1.563em;
}

/* line 59, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_02_settings_typography.scss */
.font-size-h4 {
  font-size: 1.25em;
}

/* line 60, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_02_settings_typography.scss */
.font-size-h5 {
  font-size: 1.152em;
}

/* line 300, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-version {
  font-family: "/5.5.0/";
}

/* line 304, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-small {
  font-family: "/only screen/";
  width: 0em;
}

/* line 309, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-small-only {
  font-family: "/only screen and (max-width: 40em)/";
  width: 0em;
}

/* line 314, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-medium {
  font-family: "/only screen and (min-width:40.063em)/";
  width: 40.063em;
}

/* line 319, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-medium-only {
  font-family: "/only screen and (min-width:40.063em) and (max-width:64em)/";
  width: 40.063em;
}

/* line 324, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-large {
  font-family: "/only screen and (min-width:64.063em)/";
  width: 64.063em;
}

/* line 329, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-large-only {
  font-family: "/only screen and (min-width:64.063em) and (max-width:90em)/";
  width: 64.063em;
}

/* line 334, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-xlarge {
  font-family: "/only screen and (min-width:90.063em)/";
  width: 90.063em;
}

/* line 339, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-xlarge-only {
  font-family: "/only screen and (min-width:90.063em) and (max-width:120em)/";
  width: 90.063em;
}

/* line 344, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-mq-xxlarge {
  font-family: "/only screen and (min-width:120.063em)/";
  width: 120.063em;
}

/* line 349, /Users/laurent/Repositories/commit.cubesoft.fr/_sass/_03_settings_mixins_media_queries.scss */
meta.foundation-data-attribute-namespace {
  font-family: false;
}

/* line 11 */
* {
  display: block;
}

/* line 15 */
:root {
  margin: 3em;
  background: #fdfdfd;
  color: #111;
  font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* line 23 */
feed > title {
  text-align: center;
  color: #6590aa;
  font-family: "Volkhov", Georgia, Times, serif;
  font-size: 3.6615em;
  font-weight: bolder;
}
/* line 29 */
feed > title::before {
  content: 'Atom Feed for ';
  font-weight: initial;
}
/* line 33 */
feed > title::after {
  content: "This Atom feed is meant to be used by RSS reader applications and websites.";
  display: block;
  padding: 1em;
  background-color: #DF4949;
  color: #fff;
  font-family: initial;
  font-size: initial;
  letter-spacing: initial;
}
/* line 45 */
feed > id,
feed > updated,
feed > subtitle,
feed > author,
feed > link,
feed > generator {
  display: none;
}

/* line 55 */
entry {
  padding: 1em 0;
  border-bottom: 1px solid #020202;
}
/* line 58 */
entry:last-child {
  border-bottom: none;
}
/* line 62 */
entry > title {
  color: #A1D044;
  font-family: "Volkhov", Georgia, Times, serif;
  font-size: 2.441em;
  margin-bottom: 0.5em;
}
/* line 69 */
entry > link::after {
  content: attr(href);
  color: #334D5C;
}
/* line 74 */
entry > updated {
  color: #A4A4A4;
  font-size: small;
}
/* line 79 */
entry > summary {
  margin-top: 1em;
}
/* line 83 */
entry > id,
entry > author,
entry > category,
entry > published,
entry > content {
  display: none;
}


text:
using System;
using System.Collections.Generic;
using QuantConnect.Interfaces;
using QuantConnect.Packets;

package com.quantconnect.lean.Brokerages
{
    /**
     * Provides a base implementation of IBrokerageFactory that provides a helper for reading data from a job's brokerage data dictionary
    */
    public abstract class BrokerageFactory : IBrokerageFactory
    {
        private final Class _brokerageType;

        /**
         * Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        */
         * <filterpriority>2</filterpriority>
        public abstract void Dispose();

        /**
         * Gets the type of brokerage produced by this factory
        */
        public Class BrokerageType
        {
            get { return _brokerageType; }
        }

        /**
         * Gets the brokerage data required to run the brokerage from configuration/disk
        */
         *
         * The implementation of this property will create the brokerage data dictionary required for
         * running live jobs. See <see cref="IJobQueueHandler.NextJob"/>
         *
        public abstract Map<String,String> BrokerageData { get; }

        /**
         * Gets a brokerage model that can be used to model this brokerage's unique
         * behaviors
        */
        public abstract IBrokerageModel BrokerageModel { get; }

        /**
         * Creates a new IBrokerage instance
        */
         * @param job The job packet to create the brokerage for
         * @param algorithm The algorithm instance
        @returns A new brokerage instance
        public abstract IBrokerage CreateBrokerage(LiveNodePacket job, IAlgorithm algorithm);

        /**
         * Initializes a new instance of the <see cref="BrokerageFactory"/> class for the specified <paramref name="brokerageType"/>
        */
         * @param brokerageType The type of brokerage created by this factory
        protected BrokerageFactory(Type brokerageType) {
            _brokerageType = brokerageType;
        }

        /**
         * Reads a value from the brokerage data, adding an error if the key is not found
        */
        protected static T Read<T>(ImmutableMap<String,String> brokerageData, String key, ICollection<String> errors)
            where T : IConvertible
        {
            String value;
            if( !brokerageData.TryGetValue(key, out value)) {
                errors.Add( "BrokerageFactory.CreateBrokerage(): Missing key: " + key);
                return default(T);
            }

            try
            {
                return value.ConvertTo<T>();
            }
            catch (Exception err) {
                errors.Add( String.format( "BrokerageFactory.CreateBrokerage(): Error converting key '%1$s' with value '%2$s'. %3$s", key, value, err.Message));
                return default(T);
            }
        }
    }
}


text:
title: October 1 Announcements
subtitle: October 1st Morning Announcements with Pastor Mark Hornback and Richie Runnells.
layout: default
modal-id: 1
date:  2017-10-01T15:10:55+00:00
img: white_pixel.png
thumbnail: http://img.youtube.com/vi/HM2xlGH3dd4/0.jpg
alt: https://i1.ytimg.com/vi/HM2xlGH3dd4/hqdefault.jpg
project-date:
description: <iframe width="560" height="315" src="https://www.youtube.com/embed/HM2xlGH3dd4" frameborder="0" allowfullscreen></iframe>
---


text:
<?php

namespace MessageBird\Objects;

/**
 * Class Recipients
 *
 * @package MessageBird\Objects
 */
class Recipients extends Base
{
    /**
     * @var int
     */
    public $totalCount;

    /**
     * @var int
     */
    public $totalSentCount;

    /**
     * @var int
     */
    public $totalDeliveredCount;

    /**
     * @var int
     */
    public $totalDeliveryFailedCount;

    /**
     * @var Recipient[]
     */
    public $items;

    /**
     * @param $object
     *
     * @return $this|void
     */
    public function loadFromArray($object)
    {
        parent::loadFromArray($object);

        foreach ($this->items as &$item) {
            $recipient = new Recipient();
            $recipient->loadFromArray($item);

            $item = $recipient;
        }

        return $this;
    }
}


text:
from django.test import TestCase, Client
from organizations.models import Organization

# Create your tests here.
class ViewTests(TestCase):
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_create_org(self):
        c = Client()
        response = c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        response = c.post('/organizations/create/', {'name': 'Organization_1', 'description': 'Description for org 1', 'openness': 'O'})
        self.assertRedirects(response, '/organizations/', status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)

    def test_view_org(self):
        c = Client()
        c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        # Create organization...
        c.post('/organizations/create/', {'name': 'Organization_1', 'description': 'Description for org 1', 'openness': 'O'})

        # View details about this org, should redirect to dashboard
        org = Organization.objects.all()[0]
        response = c.get('/organizations/'+str(org.id)+'/details/')
        self.assertRedirects(response, '/dashboard/', status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)

        print('Organization creation test passed')

    def test_view_nonexistant_org(self):
        c = Client()
        c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        response = c.get('/organizations/'+str(7)+'/details/')
        self.assertRedirects(response, '/organizations/', status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)
        print('Viewing non-existant organization test passed')

    def test_delete_org(self):
        c = Client()
        c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        # Create organization...
        c.post('/organizations/create/', {'name': 'Organization_1', 'description': 'Description for org 1', 'openness': 'O'})

        # Delete this org, should redirect to organizations list
        org = Organization.objects.all()[0]
        response = c.get('/organizations/'+str(org.id)+'/delete/')
        self.assertRedirects(response, '/organizations/', status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)
        print('Delete organization test passed')

    def test_delete_nonexistant_org(self):
        c = Client()
        c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        # Delete nonexistant, should redirect to organizations list
        response = c.get('/organizations/'+str(7)+'/delete/')
        self.assertRedirects(response, '/organizations/', status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)
        print('Deleting nonexistant organization test passed')

    def test_edit_org(self):
        c = Client()
        c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        # Create organization...
        c.post('/organizations/create/', {'name': 'Organization_1', 'description': 'Description for org 1', 'openness': 'O'})

        org = Organization.objects.all()[0]
        response = c.get('/organizations/'+str(org.id)+'/edit/')
        self.assertEqual(response.status_code, 200)
        print('Edit organization test passed')

    def test_nonexistant_edit_org(self):
        c = Client()
        c.post('/register/', {'username': 'aaaa', 'password': 'aaaa', 'email': 'aa@bb.cc'})

        # No organizations exist, try to visit organization 7
        response = c.get('/organizations/7/edit/')
        self.assertRedirects(response, '/organizations/', status_code=302, target_status_code=200, host=None, msg_prefix='', fetch_redirect_response=True)
        print('Edit non-existant organization test passed')


text:
package io.doov.core.dsl.impl;

import java.time.LocalTime;
import java.time.temporal.*;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;

import io.doov.core.dsl.DslField;
import io.doov.core.dsl.DslModel;
import io.doov.core.dsl.lang.Context;
import io.doov.core.dsl.meta.PredicateMetadata;

/**
 * Implements {@link LocalTime} functions for the temporal conditions.
 */
public class LocalTimeCondition extends TemporalCondition<LocalTime> {

    public LocalTimeCondition(DslField field) {
        super(field);
    }

    public LocalTimeCondition(DslField field, PredicateMetadata metadata,
                    BiFunction<DslModel, Context, Optional<LocalTime>> value) {
        super(field, metadata, value);
    }

    @Override
    protected TemporalCondition<LocalTime> temporalCondition(DslField field, PredicateMetadata metadata,
                    BiFunction<DslModel, Context, Optional<LocalTime>> value) {
        return new LocalTimeCondition(field, metadata, value);
    }

    @Override
    Function<LocalTime, LocalTime> minusFunction(int value, TemporalUnit unit) {
        return time -> time.minus(value, unit);
    }

    @Override
    Function<LocalTime, LocalTime> plusFunction(int value, TemporalUnit unit) {
        return time -> time.plus(value, unit);
    }

    @Override
    Function<LocalTime, LocalTime> withFunction(TemporalAdjuster ajuster) {
        return time -> time.with(ajuster);
    }

    @Override
    BiFunction<LocalTime, LocalTime, Boolean> afterFunction() {
        return LocalTime::isAfter;
    }

    @Override
    BiFunction<LocalTime, LocalTime, Boolean> afterOrEqualsFunction() {
        return (time1, time2) -> time1.isAfter(time2) || time1.equals(time2);
    }

    @Override
    BiFunction<LocalTime, LocalTime, Boolean> beforeFunction() {
        return LocalTime::isBefore;
    }

    @Override
    BiFunction<LocalTime, LocalTime, Boolean> beforeOrEqualsFunction() {
        return (time1, time2) -> time1.isBefore(time2) || time1.equals(time2);
    }

    @Override
    BiFunction<LocalTime, LocalTime, Long> betweenFunction(ChronoUnit unit) {
        return unit::between;
    }

}


text:
{# In newer CKANs there is a placeholder block that can be overriden #}
{# One day this template override should be simpler #}
{% set tags = h.get_facet_items_dict('tags', limit=3) %}

  <form class="module-content search-form" method="get" action="{% url_for controller='package', action='search' %}">

{{ _("Search Your Data") }}

      <input type="text" class="search" name="q" value="" autocomplete="off" />
      <button type="submit">

        {{ _('Search') }}
      </button>

  </form>

{{ _('Popular Tags') }}

    {% for tag in tags %}
      {{ h.truncate(tag.display_name, 22) }}
    {% endfor %}


text:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace MyGame
{
    public abstract class DataTableBase : ScriptableObject
    {
        public abstract void SetTableData(string tabledata);
        public abstract void SetDataListToDictionary();
    }

    public abstract class DataTableBase<T> : DataTableBase where T : DataRow_Base
    {
        [SerializeField]
        private List<T> _rows = new List<T>();
        public List<T> Rows
        {
            get { return _rows; }
        }

        private Dictionary<string, T> RowsDic = new Dictionary<string, T>();
        public override void SetTableData(string tabledata)
        {
            Rows.Clear();
            string[] datarows = tabledata.Split(new char[] { '\r', '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
            for (int i = 3; i < datarows.Length; i++)
            {
                string[] fields = datarows[i].Split(new char[] { '\t' }, System.StringSplitOptions.RemoveEmptyEntries);
                Rows.Add(SetRowData(fields));
            }
        }
        public abstract T SetRowData(string[] txtRow);

        public override void SetDataListToDictionary()
        {
            RowsDic.Clear();
            //Debug.Log("Rows Count: "+Rows.Count);
            for (int i = 0; i < Rows.Count; i++)
            {
                RowsDic.Add(Rows[i].Index, Rows[i]);
            }
        }

        public T GetRowDataByID(string id)
        {
            T t = null;
            RowsDic.TryGetValue(id, out t);
            return t;
        }
    }
    [SerializeField]
    public abstract class DataRow_Base
    {
        public abstract string Index { get; }
    }

}


text:
package org.apache.activemq.artemis.core.protocol.mqtt;

import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.MessageReference;
import org.apache.activemq.artemis.core.server.ServerConsumer;
import org.apache.activemq.artemis.core.server.ServerMessage;
import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;

public class MQTTSessionCallback implements SessionCallback {

   private final MQTTSession session;
   private final MQTTConnection connection;

   private MQTTLogger log = MQTTLogger.LOGGER;

   public MQTTSessionCallback(MQTTSession session, MQTTConnection connection) throws Exception {
      this.session = session;
      this.connection = connection;
   }

   @Override
   public boolean isWritable(ReadyListener callback) {
      return connection.isWritable(callback);
   }

   @Override
   public int sendMessage(MessageReference reference, ServerMessage message, ServerConsumer consumer, int deliveryCount) {
      try {
         session.getMqttPublishManager().sendMessage(message, consumer, deliveryCount);
      }
      catch (Exception e) {
         e.printStackTrace();
         log.warn("Unable to send message: " + message.getMessageID() + " Cause: " + e.getMessage());
      }
      return 1;
   }

   @Override
   public boolean updateDeliveryCountAfterCancel(ServerConsumer consumer, MessageReference ref, boolean failed) {
      return false;
   }

   @Override
   public int sendLargeMessageContinuation(ServerConsumer consumerID,
                                           byte[] body,
                                           boolean continues,
                                           boolean requiresResponse) {
      log.warn("Sending LARGE MESSAGE");
      return 1;
   }

   @Override
   public int sendLargeMessage(MessageReference reference, ServerMessage message, ServerConsumer consumer, long bodySize, int deliveryCount) {
      return sendMessage(reference, message, consumer, deliveryCount);
   }

   @Override
   public void disconnect(ServerConsumer consumer, String queueName) {
      try {
         consumer.removeItself();
      }
      catch (Exception e) {
         log.error(e.getMessage());
      }
   }

   @Override
   public void afterDelivery() throws Exception {

   }

   @Override
   public void browserFinished(ServerConsumer consumer) {

   }

   @Override
   public boolean hasCredits(ServerConsumer consumerID) {
      return true;
   }

   @Override
   public void sendProducerCreditsMessage(int credits, SimpleString address) {
   }

   @Override
   public void sendProducerCreditsFailMessage(int credits, SimpleString address) {
   }

   @Override
   public void closed() {
   }

}


text:
function hand(array) {

		this.array = array;

		this.calculateAP = function calculateAP() {

				var len = array.length;
				var totalAP = 0;

				for (i = 0; i < len; i++) { totalAP += array[i].actionPoints;}

				return totalAP;
		}

		this.discardHand = function discardHand() {

				discardThese = array.slice(0);
				console.log(array, discardThese);

				// Remove cards from player's hand (should only ever have 5 cards)
				array.splice(0, 5);

				return discardThese;

		}

}


text:
package org.elasticsearch.search.sort;

import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.mapper.FieldMapper;
import org.elasticsearch.search.SearchParseElement;
import org.elasticsearch.search.SearchParseException;
import org.elasticsearch.search.internal.SearchContext;

import java.util.List;

/**
 *
 */
public class SortParseElement implements SearchParseElement {

    private static final SortField SORT_SCORE = new SortField(null, SortField.Type.SCORE);
    private static final SortField SORT_SCORE_REVERSE = new SortField(null, SortField.Type.SCORE, true);
    private static final SortField SORT_DOC = new SortField(null, SortField.Type.DOC);
    private static final SortField SORT_DOC_REVERSE = new SortField(null, SortField.Type.DOC, true);

    public static final String SCORE_FIELD_NAME = "_score";
    public static final String DOC_FIELD_NAME = "_doc";

    private final ImmutableMap<String, SortParser> parsers;

    public SortParseElement() {
        ImmutableMap.Builder<String, SortParser> builder = ImmutableMap.builder();
        addParser(builder, new ScriptSortParser());
        addParser(builder, new GeoDistanceSortParser());
        this.parsers = builder.build();
    }

    private void addParser(ImmutableMap.Builder<String, SortParser> parsers, SortParser parser) {
        for (String name : parser.names()) {
            parsers.put(name, parser);
        }
    }

    @Override
    public void parse(XContentParser parser, SearchContext context) throws Exception {
        XContentParser.Token token = parser.currentToken();
        List<SortField> sortFields = Lists.newArrayListWithCapacity(2);
        if (token == XContentParser.Token.START_ARRAY) {
            while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
                if (token == XContentParser.Token.START_OBJECT) {
                    addCompoundSortField(parser, context, sortFields);
                } else if (token == XContentParser.Token.VALUE_STRING) {
                    addSortField(context, sortFields, parser.text(), false, false, null);
                }
            }
        } else {
            addCompoundSortField(parser, context, sortFields);
        }
        if (!sortFields.isEmpty()) {
            // optimize if we just sort on score non reversed, we don't really need sorting
            boolean sort;
            if (sortFields.size() > 1) {
                sort = true;
            } else {
                SortField sortField = sortFields.get(0);
                if (sortField.getType() == SortField.Type.SCORE && !sortField.getReverse()) {
                    sort = false;
                } else {
                    sort = true;
                }
            }
            if (sort) {
                context.sort(new Sort(sortFields.toArray(new SortField[sortFields.size()])));
            }
        }
    }

    private void addCompoundSortField(XContentParser parser, SearchContext context, List<SortField> sortFields) throws Exception {
        XContentParser.Token token;
        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            if (token == XContentParser.Token.FIELD_NAME) {
                String fieldName = parser.currentName();
                boolean reverse = false;
                String missing = null;
                String innerJsonName = null;
                boolean ignoreUnmapped = false;
                token = parser.nextToken();
                if (token == XContentParser.Token.VALUE_STRING) {
                    String direction = parser.text();
                    if (direction.equals("asc")) {
                        reverse = SCORE_FIELD_NAME.equals(fieldName);
                    } else if (direction.equals("desc")) {
                        reverse = !SCORE_FIELD_NAME.equals(fieldName);
                    }
                    addSortField(context, sortFields, fieldName, reverse, ignoreUnmapped, missing);
                } else {
                    if (parsers.containsKey(fieldName)) {
                        sortFields.add(parsers.get(fieldName).parse(parser, context));
                    } else {
                        while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
                            if (token == XContentParser.Token.FIELD_NAME) {
                                innerJsonName = parser.currentName();
                            } else if (token.isValue()) {
                                if ("reverse".equals(innerJsonName)) {
                                    reverse = parser.booleanValue();
                                } else if ("order".equals(innerJsonName)) {
                                    if ("asc".equals(parser.text())) {
                                        reverse = SCORE_FIELD_NAME.equals(fieldName);
                                    } else if ("desc".equals(parser.text())) {
                                        reverse = !SCORE_FIELD_NAME.equals(fieldName);
                                    }
                                } else if ("missing".equals(innerJsonName)) {
                                    missing = parser.textOrNull();
                                } else if ("ignore_unmapped".equals(innerJsonName) || "ignoreUnmapped".equals(innerJsonName)) {
                                    ignoreUnmapped = parser.booleanValue();
                                }
                            }
                        }
                        addSortField(context, sortFields, fieldName, reverse, ignoreUnmapped, missing);
                    }
                }
            }
        }
    }

    private void addSortField(SearchContext context, List<SortField> sortFields, String fieldName, boolean reverse, boolean ignoreUnmapped, @Nullable final String missing) {
        if (SCORE_FIELD_NAME.equals(fieldName)) {
            if (reverse) {
                sortFields.add(SORT_SCORE_REVERSE);
            } else {
                sortFields.add(SORT_SCORE);
            }
        } else if (DOC_FIELD_NAME.equals(fieldName)) {
            if (reverse) {
                sortFields.add(SORT_DOC_REVERSE);
            } else {
                sortFields.add(SORT_DOC);
            }
        } else {
            FieldMapper fieldMapper = context.smartNameFieldMapper(fieldName);
            if (fieldMapper == null) {
                if (ignoreUnmapped) {
                    return;
                }
                throw new SearchParseException(context, "No mapping found for [" + fieldName + "] in order to sort on");
            }
            sortFields.add(new SortField(fieldMapper.names().indexName(), fieldMapper.fieldDataType().newFieldComparatorSource(context.fieldDataCache(), missing), reverse));
        }
    }
}


text:
This folder should contain 16x16 png icons:
- add.png → icon for "Add Layer/Composition" button
- delete.png → icon for "Remove Layer" option in contect menu
- door.png → icon for "Leave the Editor" button
- mathops.png → icon for "Raster Operations" button
- palette.png → icon for "Style Layer" option in context menu
- refresh.png → icon for "Reload C" button
- save.png → icon for "Save Composition" button
- saveas.png → icon for "Save Composition as" button
- star.png → icon for "Add Composition to Favorites" button

You can pick whatever icons you like.


text:
Refactored code and functionality. The library was refactored in a way you need to instantiate a client with the API key to use it (more info in "Breaking changes"). 100% of the documented API is now supported and implemented.

The base API Response includes the `remaining_monthly_allowance` for your API key, `extra_allowance` and `allowance_refresh_timer`. These values are updated on the client instance on every request so you can use `client.remaining_monthly_client` to check how many requests the API key has left.

### New APIs

- `developers`
- `games_update`
- `genres`
- `platforms_by_name`
- `platforms_images`
- `publishers`

### Breaking changes:

- Dropped support for Ruby 2.4. The gem might still work on Ruby 2.4, but it's not being regularly tested for any version lower than 2.5.

- You now need to instantiate the Gamesdb::Client class passing in the api_key. E.g:

```ruby
> client = Gamesdb::Client.new(ENV['GAMESDB_API_KEY'])

> client = Gamesdb::Client.new('my_api_key')
> client.platforms
...
```

- Changes in methods:

- `platform_by_id` changes to `platforms_by_id`.
- `game_by_id` changes to `games_by_id`.
- `game_images` changes to `games_images`.
These APIs now support a string of comma delimited ids as parameters as well as the id Integer.

## 1.2.0
- Raise ArgumentError if api key isn't present

## 1.1.2
* Internal changes: update API endpoint url (adds `v1`), update tests

## 1.1.1
* Adds `platform_id` parameter to `games_by_name`
* Adds `page` parameter to `games_by_name`
* Adds extra fields and boxart to `games_by_name` response
* Refactors `process_platform_games`

## 1.1.0
* Adds `page` parameter to `games_by_platform_id` and includes `boxart`.
* Adds all available fields from Platforms in `platforms`, updates tests. Changes `:slug` to `:alias` in platforms response, to map to same response from API.
* Refactored `json_response` to use `includes` and extra data from the API response.

## 1.0.0

* Updated to new API endpoint, API key is now required to use the gem. Request an API Key here: https://forums.thegamesdb.net/viewforum.php?f=10
* Legacy API no longer supported since it's been shutdown.
* Since the API has changed, some endpoints are no longer supported and some new ones are supported.
* Removed ox dependency, the new returns JSON instead of XML.

## 0.2.0

* The API endpoint has been updated, so this release updates the API endpoint to the legacy.
* Updates the way the incoming XML is parsed, so more fields are available from the raw API response. It's also easier to parse using a different method from `ox` than before.
* No longer supports Ruby 2.2, it's out of support life.

## Previous versions

Implements GetGamesList, GetGame, GetArt, GetPlatformsList, GetPlatform, GetPlatformGames, PlatformGames from the original API.


text:
package org.elasticsearch.index.merge.policy;

import org.apache.lucene.codecs.DocValuesProducer;
import org.apache.lucene.index.CodecReader;
import org.apache.lucene.index.DocValuesType;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.FilterCodecReader;
import org.apache.lucene.index.IndexOptions;
import org.apache.lucene.index.NumericDocValues;
import org.apache.lucene.index.PostingsEnum;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.packed.GrowableWriter;
import org.apache.lucene.util.packed.PackedInts;
import org.elasticsearch.common.Numbers;
import org.elasticsearch.index.mapper.internal.UidFieldMapper;
import org.elasticsearch.index.mapper.internal.VersionFieldMapper;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;

/**
 * Converts 0.90.x _uid payloads to _version docvalues
 */
class VersionFieldUpgrader extends FilterCodecReader {
    final FieldInfos infos;

    VersionFieldUpgrader(CodecReader in) {
        super(in);

        // Find a free field number
        int fieldNumber = 0;
        for (FieldInfo fi : in.getFieldInfos()) {
            fieldNumber = Math.max(fieldNumber, fi.number + 1);
        }

        // TODO: lots of things can wrong here...
        FieldInfo newInfo = new FieldInfo(VersionFieldMapper.NAME,               // field name
                                          fieldNumber,                           // field number
                                          false,                                 // store term vectors
                                          false,                                 // omit norms
                                          false,                                 // store payloads
                                          IndexOptions.NONE,                     // index options
                                          DocValuesType.NUMERIC,                 // docvalues
                                          -1,                                    // docvalues generation
                                          Collections.<String, String>emptyMap() // attributes
                                          );
        newInfo.checkConsistency(); // fail merge immediately if above code is wrong

        final ArrayList<FieldInfo> fieldInfoList = new ArrayList<>();
        for (FieldInfo info : in.getFieldInfos()) {
            if (!info.name.equals(VersionFieldMapper.NAME)) {
                fieldInfoList.add(info);
            }
        }
        fieldInfoList.add(newInfo);
        infos = new FieldInfos(fieldInfoList.toArray(new FieldInfo[fieldInfoList.size()]));
    }

    static CodecReader wrap(CodecReader reader) throws IOException {
        final FieldInfos fieldInfos = reader.getFieldInfos();
        final FieldInfo versionInfo = fieldInfos.fieldInfo(VersionFieldMapper.NAME);
        if (versionInfo != null && versionInfo.getDocValuesType() != DocValuesType.NONE) {
            // the reader is a recent one, it has versions and they are stored
            // in a numeric doc values field
            return reader;
        }
        // The segment is an old one, look at the _uid field
        final Terms terms = reader.terms(UidFieldMapper.NAME);
        if (terms == null || !terms.hasPayloads()) {
            // The segment doesn't have an _uid field or doesn't have payloads
            // don't try to do anything clever. If any other segment has versions
            // all versions of this segment will be initialized to 0
            return reader;
        }
        // convert _uid payloads -> _version docvalues
        return new VersionFieldUpgrader(reader);
    }

    @Override
    public FieldInfos getFieldInfos() {
        return infos;
    }

    @Override
    public DocValuesProducer getDocValuesReader() {
        DocValuesProducer producer = in.getDocValuesReader();
        // TODO: move this nullness stuff out
        if (producer == null) {
            producer = FilterDocValuesProducer.EMPTY;
        }
        return new UninvertedVersions(producer, this);
    }

    static class UninvertedVersions extends FilterDocValuesProducer {
        final CodecReader reader;

        UninvertedVersions(DocValuesProducer in, CodecReader reader) {
            super(in);
            this.reader = reader;
        }

        @Override
        public NumericDocValues getNumeric(FieldInfo field) throws IOException {
            if (VersionFieldMapper.NAME.equals(field.name)) {
                // uninvert into a packed ints and expose as docvalues
                final Terms terms = reader.terms(UidFieldMapper.NAME);
                final TermsEnum uids = terms.iterator(null);
                final GrowableWriter versions = new GrowableWriter(2, reader.maxDoc(), PackedInts.COMPACT);
                PostingsEnum dpe = null;
                for (BytesRef uid = uids.next(); uid != null; uid = uids.next()) {
                    dpe = uids.postings(reader.getLiveDocs(), dpe, PostingsEnum.PAYLOADS);
                    assert dpe != null : "field has payloads";
                    for (int doc = dpe.nextDoc(); doc != DocIdSetIterator.NO_MORE_DOCS; doc = dpe.nextDoc()) {
                        dpe.nextPosition();
                        final BytesRef payload = dpe.getPayload();
                        if (payload != null && payload.length == 8) {
                            final long version = Numbers.bytesToLong(payload);
                            versions.set(doc, version);
                            break;
                        }
                    }
                }
                return versions;
            } else {
                return in.getNumeric(field);
            }
        }

        @Override
        public Bits getDocsWithField(FieldInfo field) throws IOException {
            if (VersionFieldMapper.NAME.equals(field.name)) {
                return new Bits.MatchAllBits(reader.maxDoc());
            } else {
                return in.getDocsWithField(field);
            }
        }

        @Override
        public DocValuesProducer getMergeInstance() throws IOException {
            return new UninvertedVersions(in.getMergeInstance(), reader);
        }
    }
}


text:
<?php

namespace WordSearch\Test;

use WordSearch\WordList;

class WordListTest extends \PHPUnit_Framework_TestCase
{
    public function testClass()
    {
        $wordList = new WordList;
        $wordList->add('test1', 1, 2);
        $wordList->add('test2', 3, 4);

        $this->assertInternalType('string', $wordList->__toString());
        $this->assertCount(2, $wordList);

        $words = [];

        foreach ($wordList as $word) {
            $words[] = $word->word;
        }

        $this->assertEquals(['test1', 'test2'], $words);
    }
}


text:
package org.anc.lapps.gate;

import gate.Document;
import gate.Factory;
import gate.FeatureMap;
import org.lappsgrid.core.DataFactory;
import org.lappsgrid.annotations.ServiceMetadata;
import org.lappsgrid.vocabulary.Annotations;
import org.lappsgrid.vocabulary.Contents;

@ServiceMetadata(
        description = "ANNIE Tokeniser from GATE.",
        requires_format = {
					 "text",
					 "xml",
					 "gate"
		  },
        produces = "http://vocab.lappsgrid.org/Token"
)
public class Tokenizer extends SimpleGateService
{
   public Tokenizer()
   {
      super(Tokenizer.class);
      createResource("gate.creole.tokeniser.DefaultTokeniser");
   }

   public String execute(String input)
   {
      Document document = null;
      try
      {
         document = doExecute(input);
      }
      catch (Exception e)
      {
         return DataFactory.error("Unable to execute the Tokenizer.", e);
      }
      if (document == null)
      {
         return DataFactory.error(BUSY);
      }
      String producer = this.getClass().getName() + "_" + Version.getVersion();

      FeatureMap features = document.getFeatures();
      Integer step = (Integer) features.get("lapps:step");
      if (step == null) {
         step = 1;
      }
      features.put("lapps:step", step + 1);
      features.put("lapps:" + Annotations.TOKEN, step + " " + producer + " " + Contents.Tokenizations.ANNIE);

      String result = DataFactory.gateDocument(document.toXml());
      Factory.deleteResource(document);
      return result;
   }
}


text:
<?php

namespace umi\orm\collection;

use umi\dbal\builder\ISelectBuilder;
use umi\orm\exception\InvalidArgumentException;
use umi\orm\exception\NotAllowedOperationException;
use umi\orm\exception\RuntimeException;
use umi\orm\metadata\field\relation\BelongsToRelationField;
use umi\orm\metadata\field\special\MaterializedPathField;
use umi\orm\object\IHierarchicObject;
use umi\orm\object\property\calculable\ICalculableProperty;
use umi\orm\selector\ISelector;

/**
 * Базовый класс иерархической коллекции
 */
abstract class BaseHierarchicCollection extends BaseCollection implements IHierarchicCollection
{
    /**
     * {@inheritdoc}
     */
    public function getForcedFieldsToLoad()
    {
        $fieldsToLoad = parent::getForcedFieldsToLoad();
        $fieldsToLoad[IHierarchicObject::FIELD_PARENT] = $this->getRequiredField(IHierarchicObject::FIELD_PARENT);
        $fieldsToLoad[IHierarchicObject::FIELD_MPATH] = $this->getRequiredField(IHierarchicObject::FIELD_MPATH);
        $fieldsToLoad[IHierarchicObject::FIELD_SLUG] = $this->getRequiredField(IHierarchicObject::FIELD_SLUG);
        $fieldsToLoad[IHierarchicObject::FIELD_URI] = $this->getRequiredField(IHierarchicObject::FIELD_URI);

        return $fieldsToLoad;
    }

    /**
     * {@inheritdoc}
     */
    public function getParentField()
    {
        return $this->getRequiredField(IHierarchicObject::FIELD_PARENT);
    }

    /**
     * {@inheritdoc}
     */
    public function getMPathField()
    {
        return $this->getRequiredField(IHierarchicObject::FIELD_MPATH);
    }

    /**
     * {@inheritdoc}
     */
    public function getHierarchyOrderField()
    {
        return $this->getRequiredField(IHierarchicObject::FIELD_ORDER);
    }

    /**
     * {@inheritdoc}
     */
    public function getHierarchyLevelField()
    {
        return $this->getRequiredField(IHierarchicObject::FIELD_HIERARCHY_LEVEL);
    }

    /**
     * {@inheritdoc}
     */
    public function getSlugField()
    {
        return $this->getRequiredField(IHierarchicObject::FIELD_SLUG);
    }

    /**
     * {@inheritdoc}
     */
    public function getURIField()
    {
        return $this->getRequiredField(IHierarchicObject::FIELD_URI);
    }

    /**
     * {@inheritdoc}
     */
    public function getMaxOrder(IHierarchicObject $branch = null)
    {
        if ($branch && !$this->contains($branch)) {
            throw new NotAllowedOperationException($this->translate(
                'Cannot calculate max order. Branch from another collection given.'
            ));
        }

        $dataSource = $this
            ->getMetadata()
            ->getCollectionDataSource();
        $orderField = $this->getHierarchyOrderField();
        $parentField = $this->getParentField();

        $platform = $dataSource->getConnection()->getDatabasePlatform();

        /**
         * @var ISelectBuilder $select
         */
        $select = $dataSource
            ->select(':' . $orderField->getName() . ' as ' . $orderField->getName())
            ->bindExpression(
                ':' . $orderField->getName(),
                'MAX(' . $platform->quoteIdentifier($orderField->getColumnName()) . ')'
            );

        if ($branch) {
            $select
                ->where()
                ->expr($parentField->getColumnName(), '=', ':' . $parentField->getName())
                ->bindValue(':' . $parentField->getName(), $branch->getId(), $parentField->getDataType());
        } else {
            $select
                ->where()
                ->expr($parentField->getColumnName(), 'IS', ':' . $parentField->getName())
                ->bindNull(':' . $parentField->getName());
        }

        return (int) $select
            ->execute()
            ->fetchColumn();

    }

    /**
     * {@inheritdoc}
     */
    public function selectChildren(
        IHierarchicObject $object = null,
        $orderBy = IHierarchicObject::FIELD_ORDER,
        $direction = ISelector::ORDER_ASC
    )
    {
        return $this->select()
            ->where(IHierarchicObject::FIELD_PARENT)->equals($object)
            ->orderBy(IHierarchicObject::FIELD_HIERARCHY_LEVEL)
            ->orderBy($orderBy, $direction);
    }

    /**
     * {@inheritdoc}
     */
    public function selectDescendants(
        IHierarchicObject $object = null,
        $depth = null,
        $orderBy = IHierarchicObject::FIELD_ORDER,
        $direction = ISelector::ORDER_ASC
    )
    {
        if (!is_null($depth)) {
            $depth = (int) $depth;
        }

        if (!is_null($depth) && $depth <= 0) {
            throw new InvalidArgumentException($this->translate(
                'Cannot select descendants. Invalid argument "depth" value.'
            ));
        }

        if (!is_null($object) && $depth === 1) {
            return $this->selectChildren($object);
        }

        $selector = $this->select();

        if ($object) {
            $selector
                ->where(IHierarchicObject::FIELD_MPATH)
                ->like($object->getMaterializedPath() . MaterializedPathField::MPATH_SEPARATOR . '%');
        }

        if ($depth) {
            if ($object) {
                $selector
                    ->where(IHierarchicObject::FIELD_HIERARCHY_LEVEL)
                    ->equalsOrLess($object->getLevel() + $depth);
            } else {
                $selector
                    ->where(IHierarchicObject::FIELD_HIERARCHY_LEVEL)
                    ->equalsOrLess($depth);
            }
        }

        $selector->orderBy(IHierarchicObject::FIELD_HIERARCHY_LEVEL);
        $selector->orderBy($orderBy, $direction);

        return $selector;
    }

    /**
     * {@inheritdoc}
     */
    public function selectAncestry(IHierarchicObject $object)
    {
        $mpath = substr($object->getMaterializedPath(), strlen(MaterializedPathField::MPATH_START_SYMBOL));

        $ids = explode(MaterializedPathField::MPATH_SEPARATOR, $mpath);
        if (count($ids) < 2) {
            return $this->emptySelect();
        }
        array_pop($ids);

        $selector = $this->select();
        $selector
            ->where(IHierarchicObject::FIELD_IDENTIFY)
            ->in($ids);

        return $selector;
    }

    /**
     * {@inheritdoc}
     */
    public function move(
        IHierarchicObject $object,
        IHierarchicObject $branch = null,
        IHierarchicObject $previousSibling = null
    )
    {
        if (!$this
            ->getObjectPersister()
            ->getIsPersisted()
        ) {
            throw new RuntimeException($this->translate(
                'Cannot move object. Not all objects are persisted. Commit transaction first.'
            ));
        }

        if (!$this->contains($object)) {
            throw new RuntimeException($this->translate(
                'Cannot move object from another hierarchy.'
            ));
        }

        if ($branch) {
            if (!$this->contains($branch)) {
                throw new RuntimeException($this->translate(
                    'Cannot move object to branch from another hierarchy.'
                ));
            }

            /**
             * @var BelongsToRelationField $parentField
             */
            $parentField = $object
                ->getProperty(IHierarchicObject::FIELD_PARENT)
                ->getField();
            $parentTargetCollectionName = $parentField->getTargetCollectionName();

            if ($this->getName() != $parentTargetCollectionName
                && $branch->getCollectionName() != $parentTargetCollectionName
            ) {
                throw new RuntimeException($this->translate(
                    'Cannot move object. Branch collection does not match object parent collection.'
                ));
            }

            $objectMpath = $object->getMaterializedPath();

            if (strpos($branch->getMaterializedPath(), $objectMpath) === 0) {
                throw new RuntimeException($this->translate(
                    'Cannot move parent object under its child.'
                ));
            }
        }

        if ($previousSibling) {
            if (!$this->contains($previousSibling)) {
                throw new RuntimeException($this->translate(
                    'Cannot move object after sibling from another hierarchy.'
                ));
            }

            if ($previousSibling->getParent() !== $branch) {
                throw new RuntimeException($this->translate(
                    'Cannot move object. Sibling should be direct child of the given parent.'
                ));
            }
        }

        if ($object->getParent() !== $branch) {

            $baseUri = $branch ? $branch->getURI() . '/' : '//';
            $newUri = $baseUri . $object->getSlug();

            $slugConflict = $this->select()
                ->where(IHierarchicObject::FIELD_URI)->equals($newUri);

            if ($slugConflict->getTotal()) {
                throw new RuntimeException($this->translate(
                    'Cannot move object with id "{id}". Slug {slug} is not unique.',
                    ['id' => $object->getId(), 'slug' => $object->getSlug()]
                ));
            }
        }

        $this->modifyMovedObjects($object, $branch, $previousSibling);

        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function changeSlug(IHierarchicObject $object, $slug)
    {
        $branch = $object->getParent();

        $baseUri = $branch ? $branch->getURI() . '/' : '//';
        $newUri = $baseUri . $slug;

        $slugConflict = $this->select()
            ->where(IHierarchicObject::FIELD_URI)->equals($newUri)
            ->where(IHierarchicObject::FIELD_IDENTIFY)->notEquals($object->getId());

        if ($slugConflict->getTotal()) {
            throw new RuntimeException($this->translate(
                'Cannot change slug for object with id "{id}". Slug {slug} is not unique.',
                ['id' => $object->getId(), 'slug' => $object->getSlug()]
            ));
        }

        $object->getProperty(IHierarchicObject::FIELD_SLUG)->setValue($slug);

        /**
         * @var ICalculableProperty $uriProperty
         */
        $uriProperty = $object->getProperty(IHierarchicObject::FIELD_URI);
        $uriProperty->recalculate();

        foreach ($this->selectDescendants($object) as $descendant) {
            $uriProperty = $descendant->getProperty(IHierarchicObject::FIELD_URI);
            $uriProperty->recalculate();
        }

        return $this;
    }

    /**
     * Запускает транзакцию по перемещению объекта.
     * @param IHierarchicObject $object перемещаемый объект
     * @param IHierarchicObject|null $branch ветка, в которую будет перемещен объект
     * @param IHierarchicObject|null $previousSibling объект, предшествующий перемещаемому
     * @throws RuntimeException если не удалось переместить объекты
     */
    protected function modifyMovedObjects(
        IHierarchicObject $object,
        IHierarchicObject $branch = null,
        IHierarchicObject $previousSibling = null
    )
    {

        $order = $previousSibling ? $previousSibling->getOrder() + 1 : 1;
        $object->getProperty(IHierarchicObject::FIELD_ORDER)->setValue($order);

        $children = $this->selectChildren($branch)
            ->where(IHierarchicObject::FIELD_ORDER)->equalsOrMore($order)
            ->where(IHierarchicObject::FIELD_IDENTIFY)->notEquals($object->getId());
        /**
         * @var IHierarchicObject $child
         */
        foreach ($children as $child) {
            $child->getProperty(IHierarchicObject::FIELD_ORDER)->setValue($child->getOrder() + 1);
        }

        if ($branch !== $object->getParent()) {
            $object->getProperty(IHierarchicObject::FIELD_PARENT)->setValue($branch);

            /**
             * @var ICalculableProperty $mpathProperty
             * @var ICalculableProperty $levelProperty
             * @var ICalculableProperty $uriProperty
             */
            $mpathProperty = $object->getProperty(IHierarchicObject::FIELD_MPATH);
            $levelProperty = $object->getProperty(IHierarchicObject::FIELD_HIERARCHY_LEVEL);
            $uriProperty = $object->getProperty(IHierarchicObject::FIELD_URI);

            $mpathProperty->recalculate();
            $levelProperty->recalculate();
            $uriProperty->recalculate();

            foreach ($this->selectDescendants($object) as $descendant) {
                $mpathProperty = $descendant->getProperty(IHierarchicObject::FIELD_MPATH);
                $levelProperty = $descendant->getProperty(IHierarchicObject::FIELD_HIERARCHY_LEVEL);
                $uriProperty = $descendant->getProperty(IHierarchicObject::FIELD_URI);

                $mpathProperty->recalculate();
                $levelProperty->recalculate();
                $uriProperty->recalculate();
            }
        }
    }
}


text:
// Copyright 2007-2017 Chris Patterson, Dru Sellers, Travis Smith, et. al.
//
// 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.
namespace MassTransit.PublishPipeSpecifications
{
    using GreenPipes;

    public interface IPublishPipeSpecification :
        IConnectPublishPipeSpecificationObserver,
        ISpecification
    {
        /// <summary>
        /// Returns the specification for the message type
        /// </summary>
        /// <typeparam name="T">The message type</typeparam>
        /// <returns></returns>
        IMessagePublishPipeSpecification<T> GetMessageSpecification<T>()
            where T : class;
    }
}


text:
define([
    'underscore',
    "protocol",
    "core-basedir/reports/qe/ui/js/common/qe.utils"
], function (_, protocolUtils, qeUtils) {
    var NMGridConfig = function () {
        var self = this;
        this.projectNetworksColumns = [
            {
                field: 'name',
                name: 'Network',
                formatter: function (r, c, v, cd, dc) {
                    return cowf.formatElementName({name: 'network', value: dc['name'], cssClass: 'cell-hyperlink-blue'});
                },
                events: {
                    onClick: ctwu.onClickNetworkMonitorGrid
                },
                minWidth: 300,
                searchFn: function (d) {
                    return d['name'];
                },
                searchable: true,
                exportConfig: {
                    allow: true,
                    stdFormatter: false
                }
            },
            {
                field: 'instCnt',
                name: 'Instances',
                minWidth: 80
            },
            {
                field: 'intfCnt',
                name: 'Interfaces',
                minWidth: 80
            },
            {
                field: '',
                name: 'Traffic In/Out (Last 1 Hr)',
                minWidth: 200,
                formatter: function (r, c, v, cd, dc) {
                    return contrail.format("{0} / {1}", cowu.addUnits2Bytes(dc['inBytes60'], true), cowu.addUnits2Bytes(dc['outBytes60'], true));
                }
            },
            {
                field: '',
                name: 'Throughput In/Out',
                minWidth: 200,
                formatter: function (r, c, v, cd, dc) {
                    return contrail.format("{0} / {1}", formatThroughput(dc['inThroughput'], true), formatThroughput(dc['outThroughput'], true));
                }
            }
        ];

      this.projectNetworksColumnsAllregions = [
                                       {
               field: 'name',
               name: 'Network',
               formatter: function (r, c, v, cd, dc) {
                   return cowf.formatElementName({name: 'network', value: dc['name'], cssClass: 'cell-hyperlink-blue'});
               },
               events: {
                   onClick: ctwu.onClickNetworkMonitorGrid
               },
               minWidth: 300,
               searchFn: function (d) {
                   return d['name'];
               },
               searchable: true,
               exportConfig: {
                   allow: true,
                   stdFormatter: false
               }
           },
           {
               field: 'instCnt',
               name: 'Instances',
               minWidth: 80
           },
           {
               field: 'intfCnt',
               name: 'Interfaces',
               minWidth: 80
           },
           {
               field: '',
               name: 'Throughput In/Out',
               minWidth: 200,
               formatter: function (r, c, v, cd, dc) {
                   return contrail.format("{0} / {1}", formatThroughput(dc['inThroughput'], true), formatThroughput(dc['outThroughput'], true));
               }
           }
       ];
        this.projectsColumns = [
            {
                field: 'name',
                name: 'Project',
                formatter: function (r, c, v, cd, dc) {
                    return cowf.formatElementName({name: 'project', value: dc['name'], cssClass: 'cell-hyperlink-blue'});
                },
                minWidth: 300,
                searchable: true,
                events: {
                    onClick: ctwu.onClickNetworkMonitorGrid
                },
                exportConfig: {
                    allow: true,
                    stdFormatter: false
                }
            },
            {
                field: 'vnCnt',
                name: 'Networks',
                minWidth: 80
            },
            {
                field: 'instCnt',
                name: 'Instances',
                minWidth: 80
            },
            {
                field: '',
                name: 'Traffic In/Out (Last 1 hr)',
                minWidth: 200,
                formatter: function (r, c, v, cd, dc) {
                    return contrail.format("{0} / {1}", cowu.addUnits2Bytes(dc['inBytes60'], true), cowu.addUnits2Bytes(dc['outBytes60'], true));
                }
            },
            {
                field: '',
                name: 'Throughput In/Out',
                minWidth: 200,
                formatter: function (r, c, v, cd, dc) {
                    return contrail.format("{0} / {1}", formatThroughput(dc['inThroughput'], true), formatThroughput(dc['outThroughput'], true));
                }
            }
        ];

        this.getNetworkVMDetailsLazyRemoteConfig = function () {
            return [
                {
                    getAjaxConfig: function (responseJSON) {
                        var nodes = responseJSON['nodes'],
                            nodeType, uuids, lazyAjaxConfig;

                        uuids = $.map(nodes, function (node) {
                            nodeType = node['node_type'];
                            if(nodeType == 'virtual-network') {
                                return node['more_attributes']['virtualmachine_list'];
                            }
                        });

                        lazyAjaxConfig = {
                            url: ctwc.URL_INSTANCES_SUMMARY,
                            type: 'POST',
                            data: JSON.stringify({
                                kfilt: uuids.join(','),
                                cfilt: ctwc.FILTERS_COLUMN_VM.join(",")
                            })
                        };

                        return lazyAjaxConfig;
                    },
                    successCallback: function (response, contrailGraphModel) {
                        var rawData = contrailGraphModel.rawData,
                            rankDir = contrailGraphModel.rankDir,
                            nodes = rawData['nodes'], vmList = response['value'],
                            elementMap = contrailGraphModel.elementMap,
                            vmMap = {}, node, vm, vnMoreAttrs, vnInstanceList, nodeType,
                            vmUUID, vmValue, nodeName, nodeElementId, nodeElement,
                            vmElementId, vmElement;

                        for(var j = 0; j < vmList.length; j++) {
                            vm = vmList[j];
                            vmMap[vm['name']] = vm['value'];
                        }

                        for(var i = 0; i < nodes.length; i++) {
                            node = nodes[i];
                            nodeName = node['name'];
                            nodeType = node['node_type'];
                            nodeElementId = elementMap['node'][nodeName];
                            nodeElement = contrailGraphModel.getCell(nodeElementId);

                            if(nodeType != 'virtual-network') {
                                continue;
                            } else {
                                vnMoreAttrs = node['more_attributes'];
                                vnMoreAttrs['virtualmachine_details'] = {};
                                vnInstanceList =  vnMoreAttrs['virtualmachine_list'];
                                for(var k = 0; k < vnInstanceList.length; k++) {
                                    vmUUID = vnInstanceList[k];
                                    vmValue = vmMap[vmUUID];
                                    vmElementId = elementMap['node'][vmUUID];
                                    vmElement = contrailGraphModel.getCell(vmElementId);
                                    if(contrail.checkIfExist(vmValue)) {
                                        vnMoreAttrs['virtualmachine_details'][vmUUID] = vmValue;
                                    }
                                    if(contrail.checkIfExist(vmElement)) {
                                        vmElement["attributes"]['nodeDetails']['uve'] = vmValue;
                                    }
                                }
                                if(contrail.checkIfExist(nodeElement)) {
                                    nodeElement["attributes"]['nodeDetails']['more_attributes']['virtualmachine_details'] = vnMoreAttrs['virtualmachine_details'];
                                }
                            }
                        }

                        contrailGraphModel.reLayoutGraph(rankDir);
                    }
                }
            ];
        };

        this.getVNStatsLazyRemoteAjaxConfig = function(responseJSON) {
            var fqns, lazyAjaxConfig;

            fqns = $.map(responseJSON, function (item) {
                return item['name'];
            });
            var whereClause = qeUtils.formatUIWhereClauseConfigByUserRole(null, "name", fqns);
            var qObj = {table: "StatTable.UveVirtualNetworkAgent.vn_stats",
                where: whereClause};
            var postData = qeUtils.formatQEUIQuery(qObj);
            lazyAjaxConfig = {
                url: cowc.URL_QE_QUERY,
                type: "POST",
                data: JSON.stringify(postData)
            };
            return lazyAjaxConfig;
        };
        this.getVNStatsLazyRemoteSuccessHandler = function(type, response, contrailListModel, parentModelList) {
            if (null == response) {
                return;
            }
            var statDataList = nmwp.statsOracleParseFn(response.data, type),
                dataItems = contrailListModel.getItems(), statData;

            for (var j = 0; j < statDataList.length; j++) {
                statData = statDataList[j];
                for (var i = 0; i < dataItems.length; i++) {
                    var dataItem = dataItems[i];
                    if (statData['name'] == dataItem['name']) {
                        dataItem['inBytes60'] = ifNull(statData['inBytes'], 0);
                        dataItem['outBytes60'] = ifNull(statData['outBytes'], 0);
                        break;
                    }
                }
            }
            contrailListModel.updateData(dataItems);
            if (contrail.checkIfExist(parentModelList)) {
                nmwp.projectNetworksDataParser(parentModelList, contrailListModel);
            }
        };

        this.getVNStatsVLOfPrimaryRemoteConfig = function (type) {
            return [{
                getAjaxConfig: function (responseJSON) {
                    return self.getVNStatsLazyRemoteAjaxConfig(responseJSON);
                },
                successCallback: function (response, contrailListModel, parentModelList) {
                    self.getVNStatsLazyRemoteSuccessHandler(type, response, contrailListModel, parentModelList);
                }
            }];
        };

        this.getVNStatsVLOfHLRemoteConfig = function (type) {
            return [{
                getAjaxConfig: function (responseJSON) {
                    return self.getVNStatsLazyRemoteAjaxConfig(responseJSON);
                },
                successCallback: function (response, contrailListModel, parentModelList) {
                    self.getVNStatsLazyRemoteSuccessHandler(type, response, parentModelList[0],
                                                            null);
                }
            }];
        };

        this.getInterfaceStatsLazyRemoteAjaxConfig = function(responseJSON) {
            var fqns, lazyAjaxConfig;

            fqns = $.map(responseJSON, function (item) {
                return item['name'];
            });

            var domCookie = contrail.getCookie(cowc.COOKIE_DOMAIN);
            var projCookie = contrail.getCookie(cowc.COOKIE_PROJECT);
            var vnCookie = contrail.getCookie(ctwc.TYPE_VIRTUAL_NETWORK);
            var whereClause = "(name Starts with " + domCookie + ":" + projCookie + ":)";
            if (ctwc.ALL_PROJECTS === projCookie) {
                whereClause = "(name Starts with " + domCookie + ":)";
            } else if (ctwc.ALL_NETWORKS == vnCookie) {
                whereClause = "(name Starts with " + domCookie + ":" +
                    projCookie + ":)";
            }

            var whereClause = qeUtils.formatUIWhereClauseConfigByUserRole(whereClause, "name", fqns);
            var qObj = {table: "StatTable.UveVMInterfaceAgent.if_stats",
                where: whereClause};
            var postData = qeUtils.formatQEUIQuery(qObj);
            lazyAjaxConfig = {
                url: cowc.URL_QE_QUERY,
                type: "POST",
                data: JSON.stringify(postData)
            };
            return lazyAjaxConfig;
        };

        this.getInterfaceStatsLazyRemoteSuccessHandler = function(response, contrailListModel,
                                                                  parentModelList) {
            if (null == response) {
                return;
            }
            var statDataList = ctwp.parseInstanceInterfaceStats(response.data),
                dataItems = contrailListModel.getItems(),
                statData;
            var statDataListLen = statDataList.length;
            var dataItemsLen = dataItems.length;
            var tmpStatDataObjs = {};
            var tmpDataItems = {};

            for (var j = 0; j < statDataList.length; j++) {
                statData = statDataList[j];
                for (var i = 0; i < dataItems.length; i++) {
                    var dataItem = dataItems[i];
                    if (statData['name'] == dataItem['vm_uuid']) {
                        dataItem['inBytes60'] = ifNull(statData['inBytes'], 0);
                        dataItem['outBytes60'] = ifNull(statData['outBytes'], 0);
                        break;
                    }
                }
            }
            contrailListModel.updateData(dataItems);
        };

        this.getInterfaceStatsVLOfHLRemoteConfig = function () {
            return [{
                getAjaxConfig: function (responseJSON) {
                    return self.getInterfaceStatsLazyRemoteAjaxConfig(responseJSON);
                },
                successCallback: function (response, contrailListModel, parentModelList) {
                    self.getInterfaceStatsLazyRemoteSuccessHandler(response, parentModelList[0],
                                                                   null);
                }
            }];
        };

        this.getInterfaceStatsVLOfPrimaryRemoteConfig = function () {
            return [{
                getAjaxConfig: function (responseJSON) {
                    return self.getInterfaceStatsLazyRemoteAjaxConfig(responseJSON);
                },
                successCallback: function (response, contrailListModel, parentModelList) {
                    self.getInterfaceStatsLazyRemoteSuccessHandler(response, contrailListModel,
                                                                   parentModelList);
                }
            }];
        };

        this.getProjectDetailsHLazyRemoteConfig = function () {
            return {
                remote: {
                    ajaxConfig: {
                        url: ctwc.get(ctwc.URL_GET_VIRTUAL_NETWORKS, 100, 1000, $.now()),
                        type: 'POST',
                        data: JSON.stringify({
                            id: qeUtils.generateQueryUUID(),
                            cfilt: ctwc.FILTERS_COLUMN_VN.join(',')
                        })
                    },
                    dataParser: nmwp.networkDataParser
                },
                vlRemoteConfig: {
                    completeCallback: function (contrailListModel, parentModelList) {
                        //ctwp.projectNetworksDataParser(parentModelList, contrailListModel);
                    },
                    vlRemoteList: nmwgc.getVNStatsVLOfPrimaryRemoteConfig(ctwc.TYPE_VIRTUAL_NETWORK)
                },
                cacheConfig: {
                    ucid: ctwc.UCID_ALL_VN_LIST
                }
            };
        };

        this.projectFlowsColumns = [
            {
                field: 'destvn',
                name: 'Destination VN',
                minWidth: 215,
                searchFn: function (d) {
                    return d['destvn'];
                },
                searchable: true
            },
            {
                field: 'sourceip',
                name: 'Source IP',
                minWidth: 100,
                searchFn: function (d) {
                    return d['sourceip'];
                },
                searchable: true
            },
            {
                field: 'destip',
                name: 'Destination IP',
                minWidth: 100,
                searchFn: function (d) {
                    return d['destip'];
                },
                searchable: true
            },
            {
                field: 'protocol',
                name: 'Protocol',
                formatter: function (r, c, v, cd, dc) {
                    return protocolUtils.getProtocolName(dc.protocol);
                },
                minWidth: 60,
                searchFn: function (d) {
                    return d['protocol'];
                },
                searchable: true
            },
            {
                field: 'sport',
                name: 'Source Port',
                minWidth: 80,
                searchFn: function (d) {
                    return d['sport'];
                },
                searchable: true
            },
            {
                field: 'dport',
                name: 'Destination Port',
                minWidth: 110,
                searchFn: function (d) {
                    return d['dport'];
                },
                searchable: true
            },
            {
                field: "SUM(bytes)",
                name: "Sum (Bytes)",
                minWidth: 80,
                searchFn: function (d) {
                    return d["SUM(bytes)"];
                },
                formatter: function (r, c, v, cd, dc) {
                    return cowu.addUnits2Bytes(dc["SUM(bytes)"]);
                },
                searchable: true
            },
            {
                field: "SUM(packets)",
                name: "Sum (Packets)",
                minWidth: 90,
                searchFn: function (d) {
                    return d["SUM(packets)"];
                },
                formatter: function (r, c, v, cd, dc) {
                    return cowu.addUnits2Packets(dc['SUM(packets)']);
                },
                searchable: true
            }
        ];

        this.getURLConfigForFlowGrid = function(hashParams) {
            var urlConfigObj = {
                'container': "#content-container",
                'context'  : "network",
                'type'     : "portRangeDetail",
                'startTime': hashParams['startTime'],
                'endTime'  : hashParams['endTime'],
                'fqName'   : hashParams['fqName'],
                'port'     : hashParams['port'],
                'portType' : hashParams['portType'],
                'ip'       : hashParams['ip']
            };
            return urlConfigObj;
        };
    };

    return NMGridConfig;
});