text:
(function(window, Builder) {
  if (typeof exports === 'object') {
    // CommonJS
    module.exports = Builder();
  } else if (typeof define === 'function' && define.amd) {
    // AMD
    define(Builder);
  } else {
    // Browser Global (dictionary is your global library identifier)
    window.dictionary = Builder();
  }
}(this, function() {
  var _dicRq_, itemToExport;

  // this is the what is defined in browserify's "entry" item in the configBundles array.
  // located in gulp/config.js under "browserify"
  itemToExport = 1;

  _dicRq_ = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dicRq_=="function"&&_dicRq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dicRq_=="function"&&_dicRq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dicRq_,_dcMd_,exports){
'use strict';

var storeManagerBuilder, dictionaryBuilder, buildDictionary;

storeManagerBuilder = _dicRq_('./dictionaryUtility/store/storeManagerBuilder');
dictionaryBuilder = _dicRq_('./dictionaryUtility/dictionaryBuilder');

buildDictionary = function(options) {
  var store, getValueKey;

  options.reservedNames = options.reservedNames ? options.reservedNames : [];

  getValueKey = options.valueKeyFunction || function(nameValue) {
    return nameValue.value;
  };

  store = storeManagerBuilder.build({
    getValueKey: getValueKey
  });

  options.reservedNames.forEach(store.addReservedName);

  return dictionaryBuilder.build(store);
};

_dcMd_.exports = {
  build: buildDictionary
};

},{"./dictionaryUtility/dictionaryBuilder":3,"./dictionaryUtility/store/storeManagerBuilder":12}],2:[function(_dicRq_,_dcMd_,exports){
(function(window, Builder) {
  if (typeof exports === 'object') {
    // CommonJS
    _dcMd_.exports = Builder();
  } else if (typeof define === 'function' && define.amd) {
    // AMD
    define(Builder);
  } else {
    // Browser Global (strings is your global library identifier)
    window.strings = Builder();
  }
}(this, function() {
  var _strRq_, itemToExport;

  // this is the what is defined in browserify's "entry" item in the configBundles array.
  // located in gulp/config.js under "browserify"
  itemToExport = 1;

  _strRq_ = (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _strRq_=="function"&&_strRq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _strRq_=="function"&&_strRq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_strRq_,_stMd_,exports){
'use strict';

var formatting = _strRq_('./utilities/formatting');

_stMd_.exports = {
  format: formatting.format
};

},{"./utilities/formatting":2}],2:[function(_strRq_,_stMd_,exports){
'use strict';

function format(stringToFormat, values) {
  return stringToFormat.replace(/{(\w+)}/g, function(match, value) {
    return (values[value] !== undefined) ? values[value] : match;
  });
}

_stMd_.exports = {
  format: format
};

},{}]},{},[1]);

//# sourceMappingURL=strings.js.map;

  return _strRq_(itemToExport);
}));
},{}],3:[function(_dicRq_,_dcMd_,exports){
'use strict';

function buildDictionary(store) {
  var dictionary = Object.create(store.data.nameValueMap);

  dictionary.$add = store.add;

  return dictionary;
}

_dcMd_.exports = {
  build: buildDictionary
};

},{}],4:[function(_dicRq_,_dcMd_,exports){
'use strict';

var nameExistsErrorDefinitionBuilder, valueExistsErrorDefinitionBuilder, reservedNameErrorDefinitionBuilder;

nameExistsErrorDefinitionBuilder = _dicRq_('./dictionaryErrors/nameExistsErrorDefinitionBuilder');
valueExistsErrorDefinitionBuilder = _dicRq_('./dictionaryErrors/valueExistsErrorDefinitionBuilder');
reservedNameErrorDefinitionBuilder = _dicRq_('./dictionaryErrors/reservedNameErrorDefinitionBuilder');

function addErrorHandling(options) {
  var errorHandling, reservedNameErrorDefinition;

  reservedNameErrorDefinition = reservedNameErrorDefinitionBuilder.build(options.store);

  errorHandling = options.errorHandling;
  errorHandling.addErrorDefinition(nameExistsErrorDefinitionBuilder.build(options.store));
  errorHandling.addErrorDefinition(valueExistsErrorDefinitionBuilder.build(options.store));
  errorHandling.addErrorDefinition(reservedNameErrorDefinition);

  errorHandling.addReservedName = reservedNameErrorDefinition.addReservedName;
}

_dcMd_.exports = {
  addErrorHandling: addErrorHandling
};

},{"./dictionaryErrors/nameExistsErrorDefinitionBuilder":5,"./dictionaryErrors/reservedNameErrorDefinitionBuilder":6,"./dictionaryErrors/valueExistsErrorDefinitionBuilder":7}],5:[function(_dicRq_,_dcMd_,exports){
'use strict';

var strings, nameExistsError;

strings = _dicRq_('strings.js');

nameExistsError = 'name "{name}" is already in use, value is {value}';

function buildNameExistsError(nameValue, store) {
  var errorText = strings.format(nameExistsError,
  {
    name: nameValue.name,
    value: store.getValueKey(nameValue)
  });

  return new Error(errorText);
}

function nameExistsErrorCondition(nameValue, store) {
  return !!store.nameValueMap[nameValue.name];
}

function buildValueExistsErrorDefinition (store) {
  return {
    errorName: 'nameExists',
    errorCondition: function(nameValue) { return nameExistsErrorCondition(nameValue, store); },
    errorBuilder: function(nameValue) { return buildNameExistsError(nameValue, store); }
  };
}

_dcMd_.exports = {
  build: buildValueExistsErrorDefinition
};

},{"strings.js":2}],6:[function(_dicRq_,_dcMd_,exports){
'use strict';

var strings, nameExistsError;

strings = _dicRq_('strings.js');

nameExistsError = 'name "{name}" is reserved for {type} dictionary';

function buildNameReservedError(nameValue, store) {
  var errorText = strings.format(nameExistsError,
  {
    name: nameValue.name,
    type: store.dictionaryName
  });

  return new Error(errorText);
}

function nameReservedErrorCondition(nameValue, reservedNames) {
  return !!reservedNames[nameValue.name];
}

function addReservedName(name, reservedNames) {
  reservedNames[name] = true;
}

function buildReservedNameErrorDefinition (store) {
  var reservedNames = {};

  return {
    errorName: 'nameReserved',
    errorCondition: function(nameValue) { return nameReservedErrorCondition(nameValue, reservedNames); },
    errorBuilder: function(nameValue) { return buildNameReservedError(nameValue, store); },
    addReservedName: function(name) { addReservedName(name, reservedNames); }
  };
}

_dcMd_.exports = {
  build: buildReservedNameErrorDefinition
};

},{"strings.js":2}],7:[function(_dicRq_,_dcMd_,exports){
'use strict';

var strings, valueExistsErrorText;

strings = _dicRq_('strings.js');

valueExistsErrorText = 'given name {givenName} with a value of "{value}" already exists with a name of "{name}"';

function buildValueExistsError(nameValue, store) {
  var errorText = strings.format(valueExistsErrorText,
  {
    givenName: nameValue.name,
    name: store.valueNameMap[store.getValueKey(nameValue)],
    value: store.getValueKey(nameValue)
  });

  return new Error(errorText);
}

function valueExistsErrorCondition(nameValue, store) {
  return !!store.valueNameMap[nameValue.value];
}

function buildValueExistsErrorDefinition (store) {
  return {
    errorName: 'valueExists',
    errorCondition: function(nameValue) { return valueExistsErrorCondition(nameValue, store); },
    errorBuilder: function(nameValue) { return buildValueExistsError(nameValue, store); }
  };
}

_dcMd_.exports = {
  build: buildValueExistsErrorDefinition
};

},{"strings.js":2}],8:[function(_dicRq_,_dcMd_,exports){
'use strict';

function throwRelevantError(errorValue, errorDefinitions) {
  errorDefinitions.forEach(function (errorDefinition){
    if(errorDefinition.condition(errorValue)) {
      throw new Error(errorDefinition.buildError(errorValue));
    }
  });
}

function addErrorDefinition(errorDefinition, errorDefinitions) {
  errorDefinitions.push({
    condition: errorDefinition.errorCondition,
    buildError: errorDefinition.errorBuilder
  });
}

function buildErrorHandling(){
  var errorHandling = {
    errorDefinitions: [],
    addErrorDefinition: function(errorDefinition){ addErrorDefinition( errorDefinition, errorHandling.errorDefinitions); },
    throwRelevantError: function(errorValue) { throwRelevantError(errorValue, errorHandling.errorDefinitions);}
  };

  return errorHandling;
}

_dcMd_.exports = {
  build: buildErrorHandling
};

},{}],9:[function(_dicRq_,_dcMd_,exports){
'use strict';

var errorHandlingBuilder, dictionaryErrorHandling;

errorHandlingBuilder = _dicRq_('../errorHandlingBuilder');
dictionaryErrorHandling = _dicRq_('../dictionaryErrorHandling');

function addErrorHandling(options) {
  var errorHandling = errorHandlingBuilder.build();

  dictionaryErrorHandling.addErrorHandling({
    store: options.store,
    dictionaryObjectName: options.dictionaryObjectName,
    errorHandling: errorHandling
  });

  options.store.errorHandling = errorHandling;

  return options.store;
}

_dcMd_.exports = {
  addToStore: addErrorHandling
};

},{"../dictionaryErrorHandling":4,"../errorHandlingBuilder":8}],10:[function(_dicRq_,_dcMd_,exports){
'use strict';

var storeErrorHandlingManager;

storeErrorHandlingManager = _dicRq_('./errorHandlingManager');

function buildDataStore(options) {
  var storeBase;

  storeBase = {
    dictionaryName: options.dictionaryName,
    nameValueMap: {},
    valueNameMap: {},
    getValueKey: options.getValueKey
  };

  storeBase = storeErrorHandlingManager.addToStore({
    store: storeBase,
    errorHandling: storeBase.errorHandling
  });

  storeBase.errorHandling.addReservedName('$add');

  return storeBase;
}

_dcMd_.exports = {
  build: buildDataStore
};

},{"./errorHandlingManager":9}],11:[function(_dicRq_,_dcMd_,exports){
'use strict';

function addSingle(nameValue, store) {
  var nameValueMap, valueNameMap;

  nameValueMap = store.nameValueMap;
  valueNameMap = store.valueNameMap;

  nameValueMap[nameValue.name] = nameValue.value;
  valueNameMap[store.getValueKey(nameValue)] = nameValue.name;
}

function checkAddSingle(options) {
  options.errorHandling.throwRelevantError(options.nameValue);
  addSingle(options.nameValue, options.store);
}

function addAll(nameValues, store) {
  var keys;

  keys = Object.keys(nameValues);

  keys.forEach(function(name) {
    checkAddSingle({
      errorHandling: store.errorHandling,
      store: store,
      nameValue: { name: name, value: nameValues[name]}
    });
  });

}

_dcMd_.exports = {
  addAll: addAll,
  addSingle: addSingle
};

},{}],12:[function(_dicRq_,_dcMd_,exports){
'use strict';

var storeBuilder, storeManagement;

storeBuilder = _dicRq_('./storeBuilder');
storeManagement = _dicRq_('./storeManagement');

function addPropertyErrorHandling(options) {
  Object.defineProperty(options.store,
    'errorHandling',
    {
      enumerable: false,
      configurable: false,
      get: function() { return options.storeBase.errorHandling; }
    });
}

function addPropertyAddReservedName(options) {
  Object.defineProperty(options.store,
    'addReservedName',
    {
      enumerable: false,
      configurable: false,
      get: function() { return options.storeBase.errorHandling.addReservedName; }
    });
}

function addProperties(options) {
  addPropertyErrorHandling(options);
  addPropertyAddReservedName(options);
}

function createStore(storeBase) {
  var store;

  store = {
    add: function(nameValues) { storeManagement.addAll(nameValues, storeBase); },
    data: storeBase
  };

  return store;
}

function buildstoreManager(options) {
  var storeBase, store;

  storeBase = storeBuilder.build(options);
  store = createStore(storeBase);

  addProperties({
    store: store,
    storeBase: storeBase
  });

  return store;
}

_dcMd_.exports = {
  build: buildstoreManager
};

},{"./storeBuilder":10,"./storeManagement":11}]},{},[1]);

//# sourceMappingURL=dictionary.js.map;

  return _dicRq_(itemToExport);
}));


text:
=encoding utf8

=head1 Name

Mo::default - Adds the default feature to Mo's has

=head1 Synopsis

    use Mo qw'default';
    has name => ( default => sub { 'Joe' } );

=head1 Description

Adds the default parameter to has, which expects a code reference, returning
a value to be used to set the attribute to if it hasn't been set yet.

Currently this is always called lazily.

=cut

redpajama_set_name: RedPajamaGithub


text:
function csrfSafeMethod(method) {
    // these HTTP methods do not require CSRF protection
    return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
}

// Set the header of each AJAX request while protecting the CSRF token from being sent to other domains
$.ajaxSetup({

    beforeSend: function(xhr, settings) {
        if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
            var csrfToken = $('meta[name="authenticityCSRFToken"]').attr('content');
            xhr.setRequestHeader("X-CSRF-Token", csrfToken);
        }
    }
});

// Manage HTTP error code
function manageErrorCode(status) {
    var redirectUrl;
    switch (status) {
        case 401:
            redirectUrl = Routing.generate('fos_user_security_login');
            window.location.replace(redirectUrl);
            break;
        case 403:
            redirectUrl = Routing.generate('fbn_guide_display_error_pages', { statusCode : status });
            window.location.replace(redirectUrl);
            break;
        case 404:
            redirectUrl = Routing.generate('fbn_guide_display_error_pages', { statusCode : status });
            window.location.replace(redirectUrl);
            break;
        default:
            break;
    }
}


text:
#ifndef GEOS_GEOM_H
#define GEOS_GEOM_H

/** \mainpage GEOS - Geometry Engine Open Source
 *
 * \section intro_sec Introduction
 *
 * Geometry Engine Open Source is a C++ port of the Java Topology Suite
 * released under the LGPL license.
 * It has interfaces for C++, C and python (though swig).
 *
 * \section getstart_sec Getting Started
 *
 * The recommended low-level interface to the GEOS library
 * is the simplified \ref c_iface. This will ensure stability of the
 * API and the ABI of the library during performance improvements
 * that will likely change classes definitions.
 *
 * If you don't care about adapting/rebuilding your client code
 * you can still use the \ref cpp_iface.
 */

/** \page c_iface C wrapper interface
 *
 * \section Overview
 *
 * This is the preferred access method for GEOS.
 *
 * It is designed to keep binary compatibility across releases.
 *
 * \section Usage
 *
 * In order to use the C-API of geos you must link your code against
 * libgeos_c.so and include the geos_c.h header file, which also contain
 * function-level documentation.
 *
 */

/** \page cpp_iface C++ interface
 *
 * \section Overview
 *
 * Main class is geos::geom::Geometry, from which all geometry types
 * derive.
 *
 * Construction and destruction of Geometries is done
 * using geos::geom::GeometryFactory.
 *
 * You'll feed it geos::geom::CoordinateSequence
 * for base geometries or vectors of geometries for collections.
 *
 * If you need to construct geometric shaped geometries, you
 * can use geos::geom::GeometricShapeFactory.
 *
 * GEOS version info (as a string) can be obtained using
 * geos::geom::geosversion(). The JTS version this release has been
 * ported from is available throu geos::geom::jtsport().
 *
 * \section io_sect Input / Output
 *
 * For WKT input/output you can use geos::io::WKTReader and geos::io::WKTWriter
 *
 * For WKB input/output you can use geos::io::WKBReader and geos::io::WKBWriter
 *
 * \section exc_sect Exceptions
 *
 * Internal exceptions are thrown as instances geos::util::GEOSException or
 * derived classes. GEOSException derives from std::exception.
 *
 * Note that prior to version 3.0.0, GEOSException were thrown by
 * pointer, and did not derive from std::exception.
 *
 */

namespace geos {

/// Contains the Geometry interface hierarchy and supporting classes.
//
/// The Java Topology Suite (JTS) is a Java API that implements a core
/// set of spatial data operations using an explicit precision model
/// and robust geometric algorithms. JTS is int ended to be used in the
/// development of applications that support the validation, cleaning,
/// integration and querying of spatial datasets.
///
/// JTS attempts to implement the OpenGIS Simple Features Specification
/// (SFS) as accurately as possible.  In some cases the SFS is unclear
/// or omits a specification; in this case J TS attempts to choose
/// a reasonable and consistent alternative.  Differences from and
/// elaborations of the SFS are documented in this specification.
///
///
Package Specification

///
/// - Java Topology Suite Technical Specifications
/// -
///   OpenGIS Simple Features Specification for SQL
///
namespace geom { // geos::geom

} // namespace geos::geom
} // namespace geos

#include <geos/geom/Coordinate.h>
#include <geos/geom/CoordinateArraySequence.h>
#include <geos/geom/CoordinateArraySequenceFactory.h>
#include <geos/geom/CoordinateFilter.h>
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/CoordinateSequenceFactory.h>
#include <geos/geom/Dimension.h>
#include <geos/geom/Envelope.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/GeometryCollection.h>
#include <geos/geom/GeometryComponentFilter.h>
#include <geos/geom/GeometryFactory.h>
#include <geos/geom/GeometryFilter.h>
#include <geos/geom/LineString.h>
#include <geos/geom/LinearRing.h>
#include <geos/geom/MultiLineString.h>
#include <geos/geom/MultiPoint.h>
#include <geos/geom/MultiPolygon.h>
#include <geos/geom/Point.h>
#include <geos/geom/Polygon.h>
#include <geos/geom/PrecisionModel.h>
#include <geos/geom/LineSegment.h>
#include <geos/geom/IntersectionMatrix.h>
#include <geos/geom/Location.h>
//#include <geos/geom/Triangle.h>

#ifdef __GNUC__
#warning *** DEPRECATED: You are using deprecated header geom.h. Please, update your sources according to new layout of GEOS headers and namespaces
#endif

using namespace geos::geom;

#endif // ndef GEOS_GEOM_H


text:
package eu.chargetime.ocpp;

import eu.chargetime.ocpp.model.Confirmation;
import eu.chargetime.ocpp.model.Request;

/** Call back handler for {@link Session} events. */
public interface SessionEvents {

  /**
   * Handle a {@link Confirmation} to a {@link Request}.
   *
   * @param uniqueId the unique id used for the {@link Request}.
   * @param confirmation the {@link Confirmation} to the {@link Request}.
   */
  void handleConfirmation(String uniqueId, Confirmation confirmation);

  /**
   * Handle a incoming {@link Request}.
   *
   * @param request the {@link Request}.
   * @return a {@link Confirmation} to send as a response.
   */
  Confirmation handleRequest(Request request) throws UnsupportedFeatureException;

  /**
   * Completes a pending request {@link Request}.
   *
   * @param uniqueId the unique id used for the {@link Request}.
   * @param confirmation the {@link Confirmation} to the {@link Request}.
   * @return a boolean indicating if pending request was found.
   */
  boolean asyncCompleteRequest(String uniqueId, Confirmation confirmation) throws UnsupportedFeatureException, OccurenceConstraintException;

  /**
   * Handle a error to a {@link Request}.
   *
   * @param uniqueId the unique identifier for the {@link Request}.
   * @param errorCode string to indicate the error.
   * @param errorDescription description of the error.
   * @param payload a raw payload.
   */
  void handleError(String uniqueId, String errorCode, String errorDescription, Object payload);

  /** Handle a closed connection. */
  void handleConnectionClosed();

  /** Handle a opened connection. */
  void handleConnectionOpened();
}


text:
id: 587d78ae367417b2b2512aff
title: Usare la proprietà order per riorganizzare gli elementi
challengeType: 0
videoUrl: 'https://scrimba.com/p/pVaDAv/cMbvNAG'
forumTopicId: 301116
dashedName: use-the-order-property-to-rearrange-items
---

# --description--

La proprietà `order` è usata per dire al CSS con che ordine gli elementi flex appaiono nel contenitore flex. Per impostazione predefinita, gli elementi appariranno nello stesso ordine con cui arrivano nell'HTML sorgente. La proprietà prende i numeri come valori, e possono essere usati anche i numeri negativi.

# --instructions--

Aggiungere la proprietà CSS `order` sia a `#box-1` che a `#box-2`. Dare a `#box-1` un valore di `2` e dare a `#box-2` un valore di `1`.

# --hints--

L'elemento `#box-1` dovrebbe avere la proprietà `order` impostata su un valore di `2`.

```js
assert($('#box-1').css('order') == '2');
```

L'elemento `#box-2` dovrebbe avere la proprietà `order` impostata su un valore di `1`.

```js
assert($('#box-2').css('order') == '1');
```

# --seed--

## --seed-contents--

```html
<style>
  #box-container {
    display: flex;
    height: 500px;
  }
  #box-1 {
    background-color: dodgerblue;

    height: 200px;
    width: 200px;
  }

  #box-2 {
    background-color: orangered;

    height: 200px;
    width: 200px;
  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>
```

# --solutions--

```html
<style>
  #box-container {
    display: flex;
    height: 500px;
  }
  #box-1 {
    background-color: dodgerblue;
    order: 2;
    height: 200px;
    width: 200px;
  }

  #box-2 {
    background-color: orangered;
    order: 1;
    height: 200px;
    width: 200px;
  }
</style>

<div id="box-container">
  <div id="box-1"></div>
  <div id="box-2"></div>
</div>
```


text:
package com.vaadin.tapio.googlemaps.client;

import com.google.gwt.ajaxloader.client.AjaxLoader;
import com.google.gwt.core.client.GWT;
import com.google.gwt.maps.client.LoadApi;
import com.google.gwt.user.client.ui.Widget;
import com.vaadin.client.communication.RpcProxy;
import com.vaadin.client.communication.StateChangeEvent;
import com.vaadin.client.ui.AbstractComponentConnector;
import com.vaadin.client.ui.layout.ElementResizeEvent;
import com.vaadin.client.ui.layout.ElementResizeListener;
import com.vaadin.shared.ui.Connect;
import com.vaadin.tapio.googlemaps.GoogleMap;
import com.vaadin.tapio.googlemaps.client.base.LatLon;
import com.vaadin.tapio.googlemaps.client.events.*;
import com.vaadin.tapio.googlemaps.client.events.centerchange.CircleCenterChangeListener;
import com.vaadin.tapio.googlemaps.client.events.click.CircleClickListener;
import com.vaadin.tapio.googlemaps.client.events.click.MapClickListener;
import com.vaadin.tapio.googlemaps.client.events.click.MarkerClickListener;
import com.vaadin.tapio.googlemaps.client.events.click.PolygonClickListener;
import com.vaadin.tapio.googlemaps.client.events.doubleclick.CircleDoubleClickListener;
import com.vaadin.tapio.googlemaps.client.events.doubleclick.MarkerDoubleClickListener;
import com.vaadin.tapio.googlemaps.client.events.overlaycomplete.CircleCompleteListener;
import com.vaadin.tapio.googlemaps.client.events.overlaycomplete.PolygonCompleteListener;
import com.vaadin.tapio.googlemaps.client.events.radiuschange.CircleRadiusChangeListener;
import com.vaadin.tapio.googlemaps.client.events.rightclick.CircleRightClickListener;
import com.vaadin.tapio.googlemaps.client.events.rightclick.MapRightClickListener;
import com.vaadin.tapio.googlemaps.client.events.rightclick.MarkerRightClickListener;
import com.vaadin.tapio.googlemaps.client.events.rightclick.PolygonRightClickListener;
import com.vaadin.tapio.googlemaps.client.overlays.GoogleMapCircle;
import com.vaadin.tapio.googlemaps.client.overlays.GoogleMapInfoWindow;
import com.vaadin.tapio.googlemaps.client.overlays.GoogleMapMarker;
import com.vaadin.tapio.googlemaps.client.overlays.GoogleMapPolygon;
import com.vaadin.tapio.googlemaps.client.rpcs.*;
import com.vaadin.tapio.googlemaps.client.rpcs.centerchange.CircleCenterChangeRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.click.CircleClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.click.MapClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.click.MarkerClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.click.PolygonClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.doubleclick.CircleDoubleClickRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.doubleclick.MarkerDoubleClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.overlaycomplete.CircleCompleteRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.overlaycomplete.PolygonCompleteRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.radiuschange.CircleRadiusChangeRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.rightclick.CircleRightClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.rightclick.MapRightClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.rightclick.MarkerRightClickedRpc;
import com.vaadin.tapio.googlemaps.client.rpcs.rightclick.PolygonRightClickedRpc;
import com.vaadin.tapio.googlemaps.client.services.DirectionsResult;
import com.vaadin.tapio.googlemaps.client.services.DirectionsStatus;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * The connector for the Google Maps JavaScript API v3.
 *
 * @author Tapio Aali <tapio@vaadin.com>
 */
@Connect(GoogleMap.class)
public class GoogleMapConnector extends AbstractComponentConnector implements
        MarkerClickListener, MarkerDoubleClickListener, MarkerDragListener, MarkerRightClickListener,
        MapMoveListener, MapClickListener, MapInitListener, MapRightClickListener,
        PolygonCompleteListener, PolygonEditListener, PolygonClickListener, PolygonRightClickListener,
        CircleClickListener, CircleDoubleClickListener, CircleCompleteListener, CircleRadiusChangeListener,
        CircleCenterChangeListener, CircleRightClickListener, DirectionsResultHandler, InfoWindowClosedListener {

    private static final long serialVersionUID = 646346521643L;

    public static boolean loadingApi = false;
    protected static boolean apiLoaded = false;
    protected static boolean mapInitiated = false;

    private boolean deferred = false;

    private InfoWindowClosedRpc infoWindowClosedRpc = RpcProxy.create(InfoWindowClosedRpc.class, this);
    private HandleDirectionsResultRpc handleDirectionsResultRpc = RpcProxy.create(HandleDirectionsResultRpc.class, this);

    private MarkerClickedRpc markerClickedRpc = RpcProxy.create(MarkerClickedRpc.class, this);
    private MarkerDoubleClickedRpc markerDoubleClickedRpc = RpcProxy.create(MarkerDoubleClickedRpc.class, this);
    private MarkerRightClickedRpc markerRightClickedRpc = RpcProxy.create(MarkerRightClickedRpc.class, this);
    private MarkerDraggedRpc markerDraggedRpc = RpcProxy.create(MarkerDraggedRpc.class, this);

    private MapClickedRpc mapClickRpc = RpcProxy.create(MapClickedRpc.class, this);
    private MapRightClickedRpc mapRightClickedRpc = RpcProxy.create(MapRightClickedRpc.class, this);
    private MapMovedRpc mapMovedRpc = RpcProxy.create(MapMovedRpc.class, this);
    private MapInitRpc mapInitRpc = RpcProxy.create(MapInitRpc.class, this);

    private PolygonClickedRpc polygonClickedRpc = RpcProxy.create(PolygonClickedRpc.class, this);
    private PolygonRightClickedRpc polygonRightClickedRpc = RpcProxy.create(PolygonRightClickedRpc.class, this);
    private PolygonCompleteRpc polygonCompleteRpc = RpcProxy.create(PolygonCompleteRpc.class, this);
    private PolygonEditRpc polygonEditRpc = RpcProxy.create(PolygonEditRpc.class, this);

    private CircleClickedRpc circleClickedRpc = RpcProxy.create(CircleClickedRpc.class, this);
    private CircleDoubleClickRpc circleDoubleClickRpc = RpcProxy.create(CircleDoubleClickRpc.class, this);
    private CircleRightClickedRpc circleRightClickedRpc = RpcProxy.create(CircleRightClickedRpc.class, this);
    private CircleCenterChangeRpc circleCenterChangeRpc = RpcProxy.create(CircleCenterChangeRpc.class, this);
    private CircleRadiusChangeRpc circleRadiusChangeRpc = RpcProxy.create(CircleRadiusChangeRpc.class, this);
    private CircleCompleteRpc circleCompleteRpc = RpcProxy.create(CircleCompleteRpc.class, this);

    public GoogleMapConnector() {
        registerRpc(PolygonRemoveVertexRpc.class, new PolygonRemoveVertexRpc() {
            @Override
            public void removeVertex(GoogleMapPolygon polygon, LatLon vertex) {
                getWidget().removeVertex(polygon, vertex);
            }
        });
    }

    private void initMap() {
        final GoogleMapWidget googleMap = getWidget();

        googleMap.setVisualRefreshEnabled(getState().visualRefreshEnabled);
        googleMap.initMap(getState().center, getState().zoom, getState().mapTypeId, this);
        googleMap.setRemoveMessage(getState().removeMessage);
        googleMap.setVertexRemovingEnabled(getState().vertexRemovingEnabled);

        googleMap.setMarkerClickListener(this);
        googleMap.setMarkerDoubleClickListener(this);
        googleMap.setMarkerRightClickListener(this);
        googleMap.setMarkerDragListener(this);

        googleMap.setMapClickListener(this);
        googleMap.setMapRightClickListener(this);
        googleMap.setMapMoveListener(this);

        googleMap.setInfoWindowClosedListener(this);
        googleMap.setDirectionsResultHandler(this);

        googleMap.setPolygonClickListener(this);
        googleMap.setPolygonRightClickListener(this);
        googleMap.setPolygonCompleteListener(this);
        googleMap.setPolygonEditListener(this);

        googleMap.setCircleClickListener(this);
        googleMap.setCircleDoubleClickListener(this);
        googleMap.setCircleRightClickListener(this);
        googleMap.setCircleCompleteListener(this);
        googleMap.setCircleCenterChangeListener(this);
        googleMap.setCircleRadiusChangeListener(this);

        if (deferred) {
            loadDeferred();
            deferred = false;
        }
        getLayoutManager().addElementResizeListener(googleMap.getElement(),
                new ElementResizeListener() {
                    @Override
                    public void onElementResize(ElementResizeEvent e) {
                        googleMap.triggerResize();
                    }
                });
    }

    @Override
    protected Widget createWidget() {
        return GWT.create(GoogleMapWidget.class);
    }

    @Override
    public GoogleMapWidget getWidget() {
        return (GoogleMapWidget) super.getWidget();
    }

    @Override
    public GoogleMapState getState() {
        return (GoogleMapState) super.getState();
    }

    @Override
    public void onStateChanged(StateChangeEvent stateChangeEvent) {
        super.onStateChanged(stateChangeEvent);
        GoogleMapWidget widget = getWidget();
        // settings that can be set without API being loaded/map initiated
        if (getState().limitCenterBounds) {
            widget.setCenterBoundLimits(getState().centerNELimit,
                    getState().centerSWLimit);
        } else {
            widget.clearCenterBoundLimits();
        }

        if (getState().limitVisibleAreaBounds) {
            widget.setVisibleAreaBoundLimits(
                    getState().visibleAreaNELimit,
                    getState().visibleAreaSWLimit);
        } else {
            widget.clearVisibleAreaBoundLimits();
        }

        // load API/init map
        if (!apiLoaded) {
            deferred = true;
            loadMapApi();
            apiLoaded = true;
            return;
        } else if (!widget.isMapInitiated()) {
            deferred = true;
            initMap();
            return;
        }

        // settings that require initiated map
        boolean initial = stateChangeEvent.isInitialStateChange();
        // do not set zoom/center again if the change originated from client
        if (!getState().locationFromClient || initial) {
            if (getState().center.getLat() != widget.getLatitude()
                    || getState().center.getLon() != widget.getLongitude()) {
                widget.setCenter(getState().center);
            }
            if (getState().zoom != widget.getZoom()) {
                widget.setZoom(getState().zoom);
            }
        }

        if (stateChangeEvent.hasPropertyChanged("removeMessage") || initial) {
            widget.setRemoveMessage(getState().removeMessage);
        }

        if (stateChangeEvent.hasPropertyChanged("vertexRemovingEnabled")) {
            widget.setVertexRemovingEnabled(getState().vertexRemovingEnabled);
        }

        if (stateChangeEvent.hasPropertyChanged("markers") || initial) {
            widget.setMarkers(getState().markers.values());
        }

        if (stateChangeEvent.hasPropertyChanged("polygons") || initial) {
            widget.setPolygonOverlays(getState().polygons);
        }

        if (stateChangeEvent.hasPropertyChanged("polylines") || initial) {
            widget.setPolylineOverlays(getState().polylines);
        }

        if (stateChangeEvent.hasPropertyChanged("circles") || initial) {
            widget.setCircleOverlays(getState().circles);
        }

        if (stateChangeEvent.hasPropertyChanged("labels") || initial) {
            widget.setLabels(getState().labels.values());
        }

        if (stateChangeEvent.hasPropertyChanged("kmlLayers") || initial) {
            widget.setKmlLayers(getState().kmlLayers);
        }

        if (stateChangeEvent.hasPropertyChanged("heatMapLayers") || initial) {
            widget.setHeatMapLayers(getState().heatMapLayers);
        }

        if (stateChangeEvent.hasPropertyChanged("imageMapTypes") || initial) {
            widget.setImageMapTypes(getState().imageMapTypes);
        }

        if (stateChangeEvent.hasPropertyChanged("overlayImageMapTypes") || initial) {
            widget.setOverlayImageMapTypes(getState().overlayImageMapTypes);
        }

        if (stateChangeEvent.hasPropertyChanged("mapTypeIds") || initial) {
            widget.setMapTypes(getState().mapTypeIds);
        }

        if (stateChangeEvent.hasPropertyChanged("directionsRequests") || initial) {
            widget.processDirectionRequests(getState().directionsRequests.values());
        }

        if (stateChangeEvent.hasPropertyChanged("mapTypeId") || initial) {
            widget.setMapType(getState().mapTypeId);
        }

        if (stateChangeEvent.hasPropertyChanged("controls") || initial) {
            widget.setControls(getState().controls);
        }

        if (stateChangeEvent.hasPropertyChanged("draggable") || initial) {
            widget.setDraggable(getState().draggable);
        }
        if (stateChangeEvent.hasPropertyChanged("keyboardShortcutsEnabled")
                || initial) {
            widget.setKeyboardShortcutsEnabled(
                    getState().keyboardShortcutsEnabled);
        }
        if (stateChangeEvent.hasPropertyChanged("scrollWheelEnabled")
                || initial) {
            widget.setScrollWheelEnabled(getState().scrollWheelEnabled);
        }
        if (stateChangeEvent.hasPropertyChanged("minZoom") || initial) {
            widget.setMinZoom(getState().minZoom);
        }
        if (stateChangeEvent.hasPropertyChanged("maxZoom") || initial) {
            widget.setMaxZoom(getState().maxZoom);
        }

        if (stateChangeEvent.hasPropertyChanged("infoWindows") || initial) {
            widget.setInfoWindows(getState().infoWindows.values());
        }

        if (stateChangeEvent.hasPropertyChanged("visualRefreshEnabled")
                || initial) {
            widget.setVisualRefreshEnabled(getState().visualRefreshEnabled);
        }

        if (stateChangeEvent.hasPropertyChanged("fitToBoundsNE")
                || stateChangeEvent.hasPropertyChanged("fitToBoundsSW")
                || initial) {
            if (getState().fitToBoundsNE != null
                    && getState().fitToBoundsSW != null) {
                widget.fitToBounds(getState().fitToBoundsNE,
                        getState().fitToBoundsSW);
            }
        }

        if (stateChangeEvent.hasPropertyChanged("drawingOptions") || initial) {
            widget.setDrawingOptions(getState().drawingOptions);
        }

        if (initial) {
            widget.triggerResize();
        }

    }

    protected void loadMapApi() {
        if (loadingApi) {
            return;
        }
        loadingApi = true;
        ArrayList<LoadApi.LoadLibrary> loadLibraries = new ArrayList<LoadApi.LoadLibrary>();
        loadLibraries.add(LoadApi.LoadLibrary.DRAWING);
        loadLibraries.add(LoadApi.LoadLibrary.VISUALIZATION);

        Runnable onLoad = new Runnable() {
            @Override
            public void run() {
                apiLoaded = true;
                loadingApi = false;
                initMap();
            }
        };

        LoadApi.Language language = null;
        if (getState().language != null) {
            language = LoadApi.Language.fromValue(getState().language);
        }

        String params = null;
        if (getState().clientId != null) {
            params = "client=" + getState().clientId;
        } else if (getState().apiKey != null) {
            params = "key=" + getState().apiKey;
        }

        if (getState().apiUrl != null) {
            AjaxLoader.init(getState().apiKey, getState().apiUrl);
        }

        load(onLoad, loadLibraries, language, getState().mapsApiVersion, params);
    }

    private static void load(Runnable onLoad, ArrayList<LoadApi.LoadLibrary> loadLibraries, LoadApi.Language language,
                             String mapsApiVersion, String otherParams) {
        String op = "";
        if (otherParams != null) {
            op = op + "&" + otherParams;
        }

        if (loadLibraries != null) {
            op = op + "&" + getLibraries(loadLibraries);
        }

        if (language != null) {
            op = op + "&language=" + language.getValue();
        }

        AjaxLoader.AjaxLoaderOptions settings = AjaxLoader.AjaxLoaderOptions.newInstance();
        settings.setOtherParms(op);
        AjaxLoader.loadApi("maps", mapsApiVersion, onLoad, settings);
    }

    private static String getLibraries(ArrayList<LoadApi.LoadLibrary> loadLibraries) {
        if (loadLibraries == null) {
            return "";
        } else {
            StringBuilder s = new StringBuilder("libraries=");
            Iterator itr = loadLibraries.iterator();
            int i = 0;

            while (itr.hasNext()) {
                LoadApi.LoadLibrary ll = (LoadApi.LoadLibrary) itr.next();
                if (ll != null) {
                    if (i > 0) {
                        s.append(",");
                    }

                    s.append(ll.value());
                    ++i;
                }
            }

            return s.toString();
        }
    }

    private void loadDeferred() {
        GoogleMapWidget googleMap = getWidget();

        googleMap.setMarkers(getState().markers.values());
        googleMap.setLabels(getState().labels.values());
        googleMap.setPolygonOverlays(getState().polygons);
        googleMap.setPolylineOverlays(getState().polylines);
        googleMap.setCircleOverlays(getState().circles);
        googleMap.setKmlLayers(getState().kmlLayers);
        googleMap.setHeatMapLayers(getState().heatMapLayers);
        googleMap.setImageMapTypes(getState().imageMapTypes);
        googleMap.setOverlayImageMapTypes(getState().overlayImageMapTypes);
        googleMap.setInfoWindows(getState().infoWindows.values());
        googleMap.setMapTypes(getState().mapTypeIds);
        googleMap.setMapType(getState().mapTypeId);
        googleMap.setControls(getState().controls);
        googleMap.setDraggable(getState().draggable);
        googleMap.setKeyboardShortcutsEnabled(
                getState().keyboardShortcutsEnabled);
        googleMap.setScrollWheelEnabled(getState().scrollWheelEnabled);
        googleMap.setMinZoom(getState().minZoom);
        googleMap.setMaxZoom(getState().maxZoom);
        googleMap.setDrawingOptions(getState().drawingOptions);
        googleMap.processDirectionRequests(getState().directionsRequests.values());
        if (getState().fitToBoundsNE != null
                && getState().fitToBoundsSW != null) {
            googleMap.fitToBounds(getState().fitToBoundsNE,
                    getState().fitToBoundsSW);
        }
    }

    @Override
    public void markerClicked(GoogleMapMarker clickedMarker) {
        if (isEnabled()) {
            markerClickedRpc.markerClicked(clickedMarker.getId());
        }
    }

    @Override
    public void markerDoubleClicked(GoogleMapMarker clickedMarker) {
        if (isEnabled()) {
            markerDoubleClickedRpc.markerClicked(clickedMarker.getId());
        }
    }

    @Override
    public void mapMoved(int zoomLevel, LatLon center, LatLon boundsNE,
                         LatLon boundsSW) {
        if (isEnabled()) {
            mapMovedRpc.mapMoved(zoomLevel, center, boundsNE, boundsSW);
        }
    }

    @Override
    public void init(LatLon center, int zoom, LatLon boundsNE, LatLon boundsSW) {
        if (isEnabled()) {
            mapInitRpc.init(center, zoom, boundsNE, boundsSW);
        }
    }

    @Override
    public void markerDragged(GoogleMapMarker draggedMarker, LatLon oldPosition) {
        if (isEnabled()) {
            markerDraggedRpc.markerDragged(draggedMarker.getId(),
                    draggedMarker.getPosition());
        }
    }

    @Override
    public void infoWindowClosed(GoogleMapInfoWindow window) {
        if (isEnabled()) {
            infoWindowClosedRpc.infoWindowClosed(window.getId());
        }
    }

    @Override
    public void polygonComplete(GoogleMapPolygon polygon) {
        if (isEnabled()) {
            polygonCompleteRpc.polygonComplete(polygon);
        }
    }

    @Override
    public void mapClicked(LatLon position) {
        if (isEnabled()) {
            mapClickRpc.mapClicked(position);
        }
    }

    @Override
    public void polygonEdited(GoogleMapPolygon polygon, ActionType actionType, int idx, LatLon latLon) {
        if (isEnabled()) {
            polygonEditRpc.polygonEdited(polygon.getId(), actionType, idx, latLon);
        }
    }

    @Override
    public void polygonClicked(GoogleMapPolygon polygon) {
        if (isEnabled()) {
            polygonClickedRpc.polygonClicked(polygon.getId());
        }
    }

    @Override
    public void handle(long requestId, DirectionsResult result, DirectionsStatus status) {
        if (isEnabled()) {
            handleDirectionsResultRpc.handle(result, status, requestId);
        }
    }

    @Override
    public void radiusChange(GoogleMapCircle circle, double oldRadius) {
        if (isEnabled()) {
            circleRadiusChangeRpc.radiusChanged(circle.getId(), circle.getRadius());
        }
    }

    @Override
    public void circleDoubleClicked(GoogleMapCircle circle) {
        if (isEnabled()) {
            circleDoubleClickRpc.circleDoubleClicked(circle.getId());
        }
    }

    @Override
    public void circleComplete(GoogleMapCircle circle) {
        if (isEnabled()) {
            circleCompleteRpc.circleComplete(circle);
        }
    }

    @Override
    public void circleClicked(GoogleMapCircle clickedCircle) {
        if (isEnabled()) {
            circleClickedRpc.circleClicked(clickedCircle.getId());
        }
    }

    @Override
    public void centerChanged(GoogleMapCircle circle, LatLon oldCenter) {
        if (isEnabled()) {
            circleCenterChangeRpc.centerChanged(circle.getId(), circle.getCenter());
        }
    }

    @Override
    public void mapRightClicked(LatLon position) {
        if (isEnabled()) {
            mapRightClickedRpc.mapRightClicked(position);
        }
    }

    @Override
    public void circleRightClicked(GoogleMapCircle circle) {
        if (isEnabled()) {
            circleRightClickedRpc.circleRightClicked(circle.getId());
        }
    }

    @Override
    public void markerRightClicked(GoogleMapMarker marker) {
        if (isEnabled()) {
            markerRightClickedRpc.markerRightClicked(marker.getId());
        }
    }

    @Override
    public void polygonRightClicked(GoogleMapPolygon polygon) {
        if (isEnabled()) {
            polygonRightClickedRpc.polygonRightClicked(polygon.getId());
        }
    }
}


text:
$(document).ready(function(){
  setResolution();
})

$(document).keydown(function(e){
  var code;
  if (e.keyCode){
    code = e.keyCode;
  } else {
    code = e.which;
  }

  if (code == 32) { // goes back to home page when space is pressed
    window.location.href = './index.html';
  }
})

function setResolution(){
  var currentHeight = $(document).height();
  $('#container').css('width', (currentHeight * 4) / 3);
  $('#instructions').css('width', (currentHeight * 4) / 6);
  // $('#container').css('height', currentHeight - 2) ;
}


text:
require 'spec_helper'

module Pronto
  module Formatter
    describe TextFormatter do
      let(:formatter) { described_class.new }

      describe '#format' do
        subject { formatter.format(messages, nil, nil) }
        let(:messages) { [message, message] }
        let(:message) { Message.new('path/to', line, :warning, 'crucial') }
        let(:line) { double(new_lineno: 1, commit_sha: '123') }

        its(:count) { should == 2 }
        its(:first) { should == 'path/to:1 W: crucial' }

        context 'message without path' do
          let(:message) { Message.new(nil, line, :warning, 'careful') }

          its(:count) { should == 2 }
          its(:first) { should == ':1 W: careful' }
        end

        context 'message without line' do
          let(:message) { Message.new('path/to', nil, :warning, 'careful') }

          its(:count) { should == 2 }
          its(:first) { should == 'path/to: W: careful' }
        end
      end
    end
  end
end


text:
package com.github.blindpirate.gogradle.core.dependency.produce.strategy;

import com.github.blindpirate.gogradle.core.dependency.GolangDependencySet;
import com.github.blindpirate.gogradle.core.dependency.ResolvedDependency;
import com.github.blindpirate.gogradle.core.dependency.produce.DependencyVisitor;

import java.io.File;

/**
 * Direct how to generate dependencies of an existing golang package module.
 */
// Default: if external exist, use it; else if vendor exist, use it; else scan source

public interface DependencyProduceStrategy {

    DependencyProduceStrategy DEFAULT_STRATEGY = new DefaultDependencyProduceStrategy();

    GolangDependencySet produce(ResolvedDependency dependency,
                                File rootDir,
                                DependencyVisitor visitor,
                                String configurationName);
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace System.Threading.Tasks.Dataflow.Tests
{
    public class SimpleNetworkTests
    {
        const int Iterations = 1000;

        [Fact]
        public async Task TransformToAction()
        {
            var t = new TransformBlock<int, int>(i => i * 2);
            int completedCount = 0;
            int prev = -2;
            var c = new ActionBlock<int>(i =>
            {
                completedCount++;
                Assert.Equal(expected: i, actual: prev + 2);
                prev = i;
            });
            t.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true });

            t.PostRange(0, Iterations);
            t.Complete();

            await c.Completion;
            Assert.True(completedCount == Iterations);
        }

        [Fact]
        public async Task TransformThroughFilterToAction()
        {
            int completedCount = 0;

            var t = new TransformBlock<int, int>(i => i);
            var c = new ActionBlock<int>(i => completedCount++);
            t.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true }, i => true);

            t.PostRange(0, Iterations);
            t.Complete();

            await c.Completion;
            Assert.Equal(expected: Iterations, actual: completedCount);
        }

        [Fact]
        public async Task TransformThroughDiscardingFilterToAction()
        {
            int completedCount = 0;

            var t = new TransformBlock<int, int>(i => i);
            var c = new ActionBlock<int>(i => completedCount++);

            t.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true }, i => i % 2 == 0);
            t.LinkTo(DataflowBlock.NullTarget<int>());

            t.PostRange(0, Iterations);
            t.Complete();

            await c.Completion;
            Assert.Equal(expected: Iterations / 2, actual: completedCount);
        }

        [Fact]
        public async Task TenTransformsToAction()
        {
            var first = new TransformBlock<int, int>(item => item);

            TransformBlock<int, int> t = first;
            for (int i = 0; i < 9; i++)
            {
                var next = new TransformBlock<int, int>(item => item);
                t.LinkTo(next, new DataflowLinkOptions { PropagateCompletion = true });
                t = next;
            }
            int completedCount = 0;
            var last = new ActionBlock<int>(i => completedCount++);
            t.LinkTo(last, new DataflowLinkOptions { PropagateCompletion = true });

            first.PostRange(0, Iterations);
            first.Complete();

            await last.Completion;
            Assert.Equal(expected: Iterations, actual: completedCount);
        }

        [Fact]
        public async Task BatchGreedyToAction()
        {
            var b = new BatchBlock<int>(1);
            int completedCount = 0;
            var c = new ActionBlock<int[]>(i => completedCount++);
            b.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true });

            b.PostRange(0, Iterations);
            b.Complete();

            await c.Completion;
            Assert.Equal(expected: Iterations / b.BatchSize, actual: completedCount);
        }

        [Fact]
        public async Task WriteOnceToAction()
        {
            int completedCount = 0;
            var c = new ActionBlock<int>(i => completedCount++);
            var singleAssignments = Enumerable.Range(0, Iterations).Select(_ =>
            {
                var s = new WriteOnceBlock<int>(i => i);
                s.LinkTo(c);
                return s;
            }).ToList();
            var ignored = Task.WhenAll(singleAssignments.Select(s => s.Completion)).ContinueWith(
                _ => c.Complete(), CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Default);

            foreach (var s in singleAssignments) s.Post(1);

            await c.Completion;
            Assert.Equal(expected: Iterations, actual: completedCount);
        }

        [Fact]
        public async Task BatchedJoinToAction()
        {
            var b = new BatchedJoinBlock<int, int>(1);

            int completedCount = 0;
            var c = new ActionBlock<Tuple<IList<int>, IList<int>>>(i => completedCount++);
            b.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true });

            for (int i = 0; i < Iterations; i++)
            {
                if (i % 2 == 0) b.Target1.Post(i);
                else b.Target2.Post(i);
            }
            b.Target1.Complete();
            b.Target2.Complete();

            await c.Completion;
            Assert.Equal(expected: Iterations / b.BatchSize, actual: completedCount);
        }

        [Fact]
        public async Task BufferBlocksToBatchNonGreedyToAction()
        {
            var inputs = Enumerable.Range(0, 1).Select(_ => new BufferBlock<int>()).ToList();
            var b = new BatchBlock<int>(inputs.Count);
            int completedCount = 0;
            var c = new ActionBlock<int[]>(i => completedCount++);

            foreach (var input in inputs) input.LinkTo(b);
            var ignored = Task.WhenAll(inputs.Select(s => s.Completion)).ContinueWith(
                _ => b.Complete(), CancellationToken.None, TaskContinuationOptions.None, TaskScheduler.Default);
            b.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true });

            for (int i = 0; i < Iterations; i++)
            {
                inputs[i % inputs.Count].Post(i);
            }
            foreach (var input in inputs) input.Complete();

            await c.Completion;
            Assert.Equal(expected: Iterations / b.BatchSize, actual: completedCount);
        }

        [Fact]
        public async Task BroadcastToActions()
        {
            var b = new BroadcastBlock<int>(i => i);
            int completedCount = 0;
            var tasks = Enumerable.Range(0, 1).Select(_ =>
            {
                var c = new ActionBlock<int>(i => Interlocked.Increment(ref completedCount));
                b.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true });
                return c.Completion;
            }).ToArray();

            var posts = Iterations / tasks.Length;
            b.PostRange(0, posts);
            b.Complete();

            await Task.WhenAll(tasks);
            Assert.Equal(expected: Iterations, actual: completedCount);
        }

        [Fact]
        public async Task TransformManyEnumerableToAction()
        {
            var data = new[] { 1 };
            var tm = new TransformManyBlock<int, int>(i => data);

            int completedCount = 0;
            var c = new ActionBlock<int>(i => completedCount++);
            tm.LinkTo(c, new DataflowLinkOptions { PropagateCompletion = true });

            tm.PostRange(0, Iterations);
            tm.Complete();

            await c.Completion;
            Assert.Equal(expected: Iterations, actual: completedCount);
        }

        [Fact]
        public async Task ActionPingPong()
        {
            var tcs = new TaskCompletionSource<bool>();

            ActionBlock<int> c1 = null, c2 = null;
            c1 = new ActionBlock<int>(i => c2.Post(i + 1));
            c2 = new ActionBlock<int>(i => {
                if (i >= Iterations) tcs.SetResult(true);
                else c1.Post(i + 1);
            });
            c1.Post(0);

            await tcs.Task;
        }

        [Fact]
        public async Task TransformPingPong()
        {
            TransformBlock<int, int> t1 = null, t2 = null;
            t1 = new TransformBlock<int, int>(i =>
            {
                if (i >= Iterations) t2.Complete();
                return i + 1;
            });
            t2 = new TransformBlock<int, int>(i => i + 1);
            t1.LinkTo(t2);
            t2.LinkTo(t1);

            t1.Post(0);
            await t2.Completion;
        }

        [Fact]
        public async Task BuffersToNonGreedyJoinToAction()
        {
            var b1 = new BufferBlock<string>();
            var b2 = new BufferBlock<int>();
            var j = new JoinBlock<string, int>(new GroupingDataflowBlockOptions { Greedy = false });
            b1.LinkTo(j.Target1, new DataflowLinkOptions { PropagateCompletion = true });
            b2.LinkTo(j.Target2, new DataflowLinkOptions { PropagateCompletion = true });
            var a = new ActionBlock<Tuple<string, int>>(t => Assert.True((t.Item1 == t.Item2.ToString())));
            j.LinkTo(a, new DataflowLinkOptions { PropagateCompletion = true });

            for (int i = 0; i < Iterations; i++)
            {
                b1.Post(i.ToString());
                b2.Post(i);
            }
            b1.Complete();
            b2.Complete();

            await a.Completion;
        }
    }
}


text:
package git

import (
	"encoding/binary"
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"sync/atomic"

	"github.com/yosisa/go-git/lru"
)

var packMagic = [4]byte{'P', 'A', 'C', 'K'}

var (
	ErrChecksum       = errors.New("Incorrect checksum")
	ErrObjectNotFound = errors.New("Object not found")
)

var packEntryCache = lru.NewWithEvict(1<<24, func(key interface{}, value interface{}) {
	value.(*packEntry).Close()
})

type PackHeader struct {
	Magic   [4]byte
	Version uint32
	Total   uint32
}

type Pack struct {
	PackHeader
	r   packReader
	idx *PackIndexV2
}

func OpenPack(path string) (*Pack, error) {
	path = filepath.Clean(path)
	ext := filepath.Ext(path)
	base := path[:len(path)-len(ext)]
	idx, err := OpenPackIndex(base + ".idx")
	if err != nil {
		return nil, err
	}
	f, err := os.Open(base + ".pack")
	if err != nil {
		return nil, err
	}
	pack := &Pack{
		r:   newPackReader(f),
		idx: idx,
	}
	err = pack.verify()
	return pack, err
}

func (p *Pack) verify() (err error) {
	if err = binary.Read(p.r, binary.BigEndian, &p.PackHeader); err != nil {
		return
	}
	if p.Magic != packMagic || p.Version != 2 {
		return ErrUnknownFormat
	}
	if _, err = p.r.Seek(-20, os.SEEK_END); err != nil {
		return
	}
	var checksum SHA1
	if err = checksum.Fill(p.r); err != nil {
		return
	}
	if checksum != p.idx.PackFileHash {
		return ErrChecksum
	}
	return
}

func (p *Pack) Close() error {
	return p.r.Close()
}

func (p *Pack) Object(id SHA1, repo *Repository) (Object, error) {
	entry, err := p.entry(id)
	if err != nil {
		return nil, err
	}
	obj := newObject(entry.Type(), id, repo)
	b, err := entry.ReadAll()
	if err != nil {
		return nil, err
	}
	obj.Parse(b)
	return obj, nil
}

func (p *Pack) entry(id SHA1) (*packEntry, error) {
	entry := p.idx.Entry(id)
	if entry == nil {
		return nil, ErrObjectNotFound
	}
	return p.entryAt(entry.Offset)
}

func (p *Pack) entryAt(offset int64) (*packEntry, error) {
	if pe, ok := packEntryCache.Get(pecKey{p.idx.PackFileHash, offset}); ok {
		if entry := pe.(*packEntry); entry.markInUse() {
			return entry, nil
		}
	}

	if _, err := p.r.Seek(offset, os.SEEK_SET); err != nil {
		return nil, err
	}

	header, err := readPackEntryHeader(p.r)
	if err != nil {
		return nil, err
	}
	size := header[0].Size0()
	typ := header[0].Type()
	for i, l := 0, len(header)-1; i < l; i++ {
		size = (header[i+1].Size() << uint(4+7*i)) | size
	}

	pe := &packEntry{
		offset:    offset,
		headerLen: len(header),
		used:      1,
	}

	switch typ {
	case packEntryCommit:
		pe.typ = "commit"
	case packEntryTree:
		pe.typ = "tree"
	case packEntryBlob:
		pe.typ = "blob"
	case packEntryTag:
		pe.typ = "tag"
	case packEntryOfsDelta:
		header, err := readPackEntryHeader(p.r)
		if err != nil {
			return nil, err
		}
		ofs := header[0].Size()
		for _, h := range header[1:] {
			ofs += 1
			ofs = (ofs << 7) + h.Size()
		}
		delta, err := p.readDelta()
		if err != nil {
			return nil, err
		}

		entry, err := p.entryAt(offset - ofs)
		if err != nil {
			return nil, err
		}
		pe.typ = entry.Type()
		if pe.buf, err = applyDelta(entry, delta); err != nil {
			return nil, err
		}
		packEntryCache.Add(pecKey{p.idx.PackFileHash, offset}, pe)
		return pe, nil
	case packEntryRefDelta:
		id, err := readSHA1(p.r)
		if err != nil {
			return nil, err
		}
		delta, err := p.readDelta()
		if err != nil {
			return nil, err
		}

		entry, err := p.entry(id)
		if err != nil {
			return nil, err
		}
		pe.typ = entry.Type()
		if pe.buf, err = applyDelta(entry, delta); err != nil {
			return nil, err
		}
		packEntryCache.Add(pecKey{p.idx.PackFileHash, offset}, pe)
		return pe, nil
	default:
		return nil, fmt.Errorf("Unknown pack entry type: %d", typ)
	}

	pe.pr = p.r
	packEntryCache.Add(pecKey{p.idx.PackFileHash, offset}, pe)
	return pe, nil
}

func (p *Pack) readDelta() (*bytesBuffer, error) {
	zr, err := p.r.ZlibReader()
	if err != nil {
		return nil, err
	}
	defer zr.Close()
	return newBytesBuffer(zr)
}

type packEntryType byte

const (
	packEntryNone packEntryType = iota
	packEntryCommit
	packEntryTree
	packEntryBlob
	packEntryTag
	_
	packEntryOfsDelta
	packEntryRefDelta
)

type packEntry struct {
	typ       string
	buf       *bytesBuffer
	pr        packReader
	offset    int64
	headerLen int
	used      int32
}

func (p *packEntry) Type() string {
	return p.typ
}

func (p *packEntry) ReadAll() ([]byte, error) {
	if p.buf == nil {
		if p.pr.Offset() != p.offset {
			if _, err := p.pr.Seek(p.offset+int64(p.headerLen), os.SEEK_SET); err != nil {
				return nil, err
			}
		}
		zr, err := p.pr.ZlibReader()
		if err != nil {
			return nil, err
		}
		defer zr.Close()

		if p.buf, err = newBytesBuffer(zr); err != nil {
			return nil, err
		}
	}
	return p.buf.Bytes(), nil
}

func (p *packEntry) Close() (err error) {
	// Release bytesBuffer only if no one used and not in the lru cache.
	if n := atomic.AddInt32(&p.used, -1); n < 0 && p.buf != nil {
		p.buf.Close()
	}
	return
}

func (p *packEntry) markInUse() bool {
	return atomic.AddInt32(&p.used, 1) > 0
}

func (p *packEntry) Size() int {
	size := len(p.typ) + 8 + 8 + 8 + 8
	if p.buf != nil {
		size += p.buf.Len()
	}
	return size
}

type packEntryHeader byte

func (b packEntryHeader) MSB() bool {
	return (b >> 7) == 1
}

func (b packEntryHeader) Type() packEntryType {
	return packEntryType((b >> 4) & 0x07)
}

func (b packEntryHeader) Size0() int64 {
	return int64(b & 0x0f)
}

func (b packEntryHeader) Size() int64 {
	return int64(b & 0x7f)
}

var packEntryHeaderScratch []packEntryHeader = make([]packEntryHeader, 0, 10)

func readPackEntryHeader(br byteReader) (header []packEntryHeader, err error) {
	header = packEntryHeaderScratch[:0]
	for {
		var b byte
		if b, err = br.ReadByte(); err != nil {
			return
		}
		h := packEntryHeader(b)
		header = append(header, h)
		if !h.MSB() {
			return
		}
	}
}

type pecKey struct {
	checksum SHA1
	offset   int64
}


text:
<?php

namespace Core\ViewModel\Header;

class HeaderTertiaryList
{
    /** @var HeaderTertiaryListElementInterface[] */
    protected $rows = [];

    /**
     * @param string $text
     *
     * @return HeaderTertiaryListElementFlowInterface
     */
    public function addElement($text)
    {
        $element = new HeaderTertiaryListElement($text);
        $this->rows[] = $element;

        return $element;
    }

    public function getElements()
    {
        return $this->rows;
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<rootTag>
  <Award>
    <AwardTitle>Survey of Graduate Students and Postdoctorates in Science & Engineering</AwardTitle>
    <AwardEffectiveDate>06/15/2014</AwardEffectiveDate>
    <AwardExpirationDate>06/30/2019</AwardExpirationDate>
    <AwardAmount>2387318</AwardAmount>
    <AwardInstrument>
      <Value>Contract</Value>
    </AwardInstrument>
    <Organization>
      04030004
      <Directorate>
        <LongName>Direct For Social, Behav & Economic Scie</LongName>
      </Directorate>
      <Division>
        <LongName>National Center For S&E Statistics</LongName>
      </Division>
    </Organization>
    <ProgramOfficer>
      <SignBlockName>Kelly H. Kang</SignBlockName>
    </ProgramOfficer>
    <AbstractNarration/>
    <MinAmdLetterDate>06/04/2014</MinAmdLetterDate>
    <MaxAmdLetterDate>06/26/2014</MaxAmdLetterDate>
    <ARRAAmount/>
    <AwardID>1445223</AwardID>
    <Investigator>
      <FirstName>Patricia</FirstName>
      <LastName>Green</LastName>
      <EmailAddress/>
      <StartDate>06/04/2014</StartDate>
      <EndDate/>
      <RoleCode>Principal Investigator</RoleCode>
    </Investigator>
    <Institution>
      <Name>Research Triangle Institute</Name>
      <CityName>Research Triangle Park</CityName>
      <ZipCode>277092194</ZipCode>
      <PhoneNumber>9195416000</PhoneNumber>
      <StreetAddress>3040 Cornwallis Road</StreetAddress>
      <CountryName>United States</CountryName>
      <StateName>North Carolina</StateName>
      <StateCode>NC</StateCode>
    </Institution>
  </Award>
</rootTag>


text:
<?php

namespace Reshadman\FileSecretary\Application\Privacy;

use Reshadman\FileSecretary\Application\PrivacyCheckNeeds;

class NotAllowedPrivacy implements PrivacyInterface
{
    public function isAllowed(PrivacyCheckNeeds $needs)
    {
        return false;
    }
}


text:
typedef void(^WhiteBgButtonDidClick)(NSInteger index);
typedef void(^GrayBgButtonDidClick)(BOOL hidden);

typedef NS_ENUM(NSInteger,ZWHOptionViewPlatformType) {
    ZWHOptionViewPlatformTypeShare1,
    ZWHOptionViewPlatformTypeShare2
};

@interface ZWHOptionView : UIView

- (instancetype)initWithFrame:(CGRect)frame andButtonImageName:(NSString *)imageName dropDownListTitleArray:(NSArray<NSString *> *)titleArr platformType:(ZWHOptionViewPlatformType)type;

- (void)handleClickEventsWhiteBlock:(WhiteBgButtonDidClick)whiteBlock andGrayBlock:(GrayBgButtonDidClick)grayBlock;

- (void)refresh;

@end


text:
Mbokai-alfredtheme
==================

Alfred theme inspired by MBO and Monokai


text:
@interface MBEOBJGroup : NSObject

- (instancetype)initWithName:(NSString *)name;

@property (copy) NSString *name;
@property (copy) NSData *vertexData;
@property (copy) NSData *indexData;

@end


text:
The class for heat (temperature) maps generation. It can be used for overlays on maps for example. [Live example](https://квартиры-домики.рф/Карта-цен).

# Using:
```C#
//Test points with values from -100 to 100
List<PointWithValue> pnts = new List<PointWithValue>();
pnts.Add(new PointWithValue() { X = 50, Y = 50, Value = -100 });
pnts.Add(new PointWithValue() { X = 250, Y = 25, Value = 45 });
pnts.Add(new PointWithValue() { X = 450, Y = 125, Value = 10 });
pnts.Add(new PointWithValue() { X = 25, Y = 300, Value = -50 });
pnts.Add(new PointWithValue() { X = 250, Y = 350, Value = 0 });
pnts.Add(new PointWithValue() { X = 410, Y = 410, Value = 100 });

HeatMap hm = new HeatMap();
hm.Points = pnts;
hm.Width = 500;
hm.Height = 500;
var bitmap = hm.Draw();
bitmap.Save("TestMapResult.png");
```

Test points used in example:

![Test Points](https://raw.githubusercontent.com/d-sky/HeatMap/master/TestMapPoints.png)

The result:

![Result](https://raw.githubusercontent.com/d-sky/HeatMap/master/TestMapResult.png)


text:
Protocol Documentation - 0.12.1
=====================================

This document describes the protocol extensions for all additional functionality build into the Dash protocol. This doesn't include any of the Bitcoin protocol, which has been left intact in the Dash project. For more information about the core protocol, please see https://en.bitcoin.it/w/index.php?title#Protocol_documentation&action#edit

## Common Structures

### Simple types

uint256  => char[32]

CScript => uchar[]

### COutPoint

Bitcoin Outpoint https://bitcoin.org/en/glossary/outpoint

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 32 | hash | uint256 | Hash of transactional output which is being referenced
| 4 | n | uint32_t | Index of transaction which is being referenced

### CTxIn

Bitcoin Input https://bitcoin.org/en/glossary/input

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 36 | prevout | [COutPoint](#coutpoint) | The previous output from an existing transaction, in the form of an unspent output
| 1+ | script length | var_int | The length of the signature script
| ? | script | CScript | The script which is validated for this input to be spent
| 4 | nSequence | uint_32t | Transaction version as defined by the sender. Intended for "replacement" of transactions when information is updated before inclusion into a block.

### CTxOut

Bitcoin Output https://bitcoin.org/en/glossary/output

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 8 | nValue | int64_t | Transfered value
| ? | scriptPubKey | CScript | The script for indicating what conditions must be fulfilled for this output to be further spent

### CTransaction

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nVersion | int32_t | Transaction data format version
| 1+ | tx_in count | var_int | Number of Transaction inputs
| 41+ | vin | [CTxIn](#ctxin) | A list of 1 or more transaction inputs
| 1+ | tx_out count | var_int | Number of Transaction outputs
| 9+ | vout | [CTxOut](#ctxout) | A list of 1 or more transaction outputs
| 4 | nLockTime | uint32_t | The block number or timestamp at which this transaction is unlocked

### CPubKey

Bitcoin Public Key https://bitcoin.org/en/glossary/public-key

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 33-65 | vch | char[] | The public portion of a keypair which can be used to verify signatures made with the private portion of the keypair.

### CService

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 16 | IP | CNetAddr | IP Address
| 2 | Port | uint16 | IP Port

## Message Types

### MNANNOUNCE - "mnb"

CMasternodeBroadcast

Whenever a masternode comes online or a client is syncing, they will send this message which describes the masternode entry and how to validate messages from it.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 41 | vin | [CTxIn](#ctxin) | The unspent output which is holding 1000 DASH
| # | addr | [CService](#cservice) | IPv4 address of the masternode
| 33-65 | pubKeyCollateralAddress | [CPubKey](#cpubkey) | CPubKey of the main 1000 DASH unspent output
| 33-65 | pubKeyMasternode | [CPubKey](#cpubkey) | CPubKey of the secondary signing key (For all other messaging other than announce message)
| 71-73 | sig | char[] | Signature of this message (verifiable via pubKeyCollateralAddress)
| 8 | sigTime | int64_t | Time which the signature was created
| 4 | nProtocolVersion | int | The protocol version of the masternode
| # | lastPing | CMasternodePing | The last known ping of the masternode
| 8 | nLastDsq | int64_t | The last time the masternode sent a DSQ message (for mixing) (DEPRECATED)

### MNPING - "mnp"

CMasternodePing

Every few minutes, masternodes ping the network with a message that propagates the whole network.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 41 | vin | [CTxIn](#ctxin) | The unspent output of the masternode which is signing the message
| 32 | blockHash | uint256 | Current chaintip blockhash minus 12
| 8 | sigTime | int64_t | Signature time for this ping
| 71-73 | vchSig | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)

### MASTERNODEPAYMENTVOTE - "mnw"

CMasternodePaymentVote

When a new block is found on the network, a masternode quorum will be determined and those 10 selected masternodes will issue a masternode payment vote message to pick the next winning node.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 41 | vinMasternode | [CTxIn](#ctxin) | The unspent output of the masternode which is signing the message
| 4 | nBlockHeight | int | The blockheight which the payee should be paid
| ? | payeeAddress | CScript | The address to pay to
| 71-73 | sig | char[] | Signature of the masternode which is signing the message

### DSTX - "dstx"

CDarksendBroadcastTx

Masternodes can broadcast subsidised transactions without fees for the sake of security in mixing. This is done via the DSTX message.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| # | tx | [CTransaction](#ctransaction) | The transaction
| 41 | vin | [CTxIn](#ctxin) | Masternode unspent output
| 71-73 | vchSig | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)
| 8 | sigTime | int64_t | Time this message was signed

### DSSTATUSUPDATE - "dssu"

Mixing pool status update

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nMsgSessionID | int | Session ID
| 4 | nMsgState | int | Current state of mixing process
| 4 | nMsgEntriesCount | int | Number of entries in the mixing pool
| 4 | nMsgStatusUpdate | int | Update state and/or signal if entry was accepted or not
| 4 | nMsgMessageID | int | ID of the typical masternode reply message

### DSQUEUE - "dsq"

CDarksendQueue

Asks users to sign final mixing tx message.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nDenom | int | Which denomination is allowed in this mixing session
| 41 | vin | [CTxIn](#ctxin) | unspend output from masternode which is hosting this session
| 4 | nTime | int | the time this DSQ was created
| 4 | fReady | int | if the mixing pool is ready to be executed
| 71-73 | vchSig | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)

### DSACCEPT - "dsa"

Response to DSQ message which allows the user to join a mixing pool

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nDenom | int | denomination that will be exclusively used when submitting inputs into the pool
| 41+ | txCollateral | int | collateral tx that will be charged if this client acts maliciousely

### DSVIN - "dsi"

CDarkSendEntry

When queue is ready user is expected to send his entry to start actual mixing

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| ? | vecTxDSIn | CTxDSIn[] | vector of users inputs (CTxDSIn serialization is equal to [CTxIn](#ctxin) serialization)
| 8 | nAmount | int64_t | depreciated since 12.1, it's used for backwards compatibility only and can be removed with future protocol bump
| ? | txCollateral | [CTransaction](#ctransaction) | Collateral transaction which is used to prevent misbehavior and also to charge fees randomly
| ? | vecTxDSOut | CTxDSOut[] | vector of user outputs (CTxDSOut serialization is equal to [CTxOut](#ctxout) serialization)

### DSSIGNFINALTX - "dss"

User's signed inputs for a group transaction in a mixing session

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| # | inputs | [CTxIn](#ctxin)[] | signed inputs for mixing session

### TXLOCKREQUEST - "ix"

CTxLockRequest

Transaction Lock Request, serialization is the same as for [CTransaction](#ctransaction).

### TXLOCKVOTE - "txlvote"

CTxLockVote

Transaction Lock Vote

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 32 | txHash | uint256 | txid of the transaction to lock
| 36 | outpoint | [COutPoint](#coutpoint) | The utxo to lock in this transaction
| 36 | outpointMasternode | [COutPoint](#coutpoint) | The utxo of the masternode which is signing the vote
| 71-73 | vchMasternodeSignature | char[] | Signature of this message by masternode (verifiable via pubKeyMasternode)

### MNGOVERNANCEOBJECT - "govobj"

Governance Object

A proposal, contract or setting.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 32 | nHashParent | uint256 | Parent object, 0 is root
| 4 | nRevision | int | Object revision in the system
| 8 | nTime | int64_t | Time which this object was created
| 32 | nCollateralHash | uint256 | Hash of the collateral fee transaction
| 0-16384 | strData | string | Data field - can be used for anything
| 4 | nObjectType | int | ????
| 41 | vinMasternode | [CTxIn](#ctxin) | Unspent output for the masternode which is signing this object
| 66* | vchSig | char[] | Signature of the masternode (unclear if 66 is the correct size, but this is what it appears to be in most cases)

### MNGOVERNANCEOBJECTVOTE - "govobjvote"

Governance Vote

Masternodes use governance voting in response to new proposals, contracts, settings or finalized budgets.

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 41+ | vinMasternode | [CTxIn](#ctxin) | Unspent output for the masternode which is voting
| 32 | nParentHash | uint256 | Object which we're voting on (proposal, contract, setting or final budget)
| 4 | nVoteOutcome | int | ???
| 4 | nVoteSignal | int | ???
| 8 | nTime | int64_t | Time which the vote was created
| 66* | vchSig | char[] | Signature of the masternode (unclear if 66 is the correct size, but this is what it appears to be in most cases)

### SPORK - "spork"

Spork

Spork

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nSporkID | int |
| 8 | nValue | int64_t |
| 8 | nTimeSigned | int64_t |
| 66* | vchSig | char[] | Unclear if 66 is the correct size, but this is what it appears to be in most cases

#### Defined Sporks (per src/sporks.h)

| Spork ID | Number | Name | Description |
| ---------- | ---------- | ----------- | ----------- |
| 10001 | 2 | INSTANTSEND_ENABLED | Turns on and off InstantSend network wide
| 10002 | 3 | INSTANTSEND_BLOCK_FILTERING | Turns on and off InstantSend block filtering
| 10004 | 5 | INSTANTSEND_MAX_VALUE | Controls the max value for an InstantSend transaction (currently 2000 dash)
| 10007 | 8 | MASTERNODE_PAYMENT_ENFORCEMENT | Requires masternodes to be paid by miners when blocks are processed
| 10008 | 9 | SUPERBLOCKS_ENABLED | Superblocks are enabled (the 10% comes to fund the dash treasury)
| 10009 | 10 | MASTERNODE_PAY_UPDATED_NODES | Only current protocol version masternode's will be paid (not older nodes)
| 10011 | 12 | RECONSIDER_BLOCKS |
| 10012 | 13 | OLD_SUPERBLOCK_FLAG |
| 10013 | 14 | REQUIRE_SENTINEL_FLAG | Only masternode's running sentinel will be paid

## Undocumented messages

### MASTERNODEPAYMENTBLOCK - "mnwb"

Masternode Payment Block

*NOTE: Per src/protocol.cpp, there is no message for this (only inventory)*

### MNVERIFY - "mnv"

Masternode Verify

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 41 | vin1 | [CTxIn](#ctxin) | The unspent output which is holding 1000 DASH for masternode 1
| 41 | vin2 | [CTxIn](#ctxin) | The unspent output which is holding 1000 DASH for masternode 2
| # | addr | [CService](#cservice) | IPv4 address / port of the masternode
| 4 | nonce | int | Nonce
| 4 | nBlockHeight | int | The blockheight
| 66* | vchSig1 | char[] | Signature of by masternode 1 (unclear if 66 is the correct size, but this is what it appears to be in most cases)
| 66* | vchSig2 | char[] | Signature of by masternode 2 (unclear if 66 is the correct size, but this is what it appears to be in most cases)

### DSFINALTX - "dsf"

Darksend Final Transaction

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nSessionID | int |
| # | txFinal | [CTransaction](#ctransaction) | Final mixing transaction

### DSCOMPLETE - "dsc"

Darksend Complete

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nSessionID | int |
| 4 | nMessageID | int |

### MNGOVERNANCESYNC - "govsync"

Governance Sync

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 32 | nHash | uint256 |
| # | filter | CBloomFilter |

### DSEG - "dseg"

Masternode List/Entry Sync

Get Masternode list or specific entry

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 41 | vin | [CTxIn](#ctxin) | The unspent output which is holding 1000 DASH

### SYNCSTATUSCOUNT - "ssc"

Sync Status Count

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nItemID | int | Masternode Sync Item ID
| 4 | nCount | int | Masternode Sync Count

#### Defined Sync Item IDs (per src/masternode-sync.h)

| Item ID | Name | Description |
| ---------- | ---------- | ----------- |
| 2 | MASTERNODE_SYNC_LIST |
| 3 | MASTERNODE_SYNC_MNW |
| 4 | MASTERNODE_SYNC_GOVERNANCE |
| 10 | MASTERNODE_SYNC_GOVOBJ |
| 11 | MASTERNODE_SYNC_GOVOBJ_VOTE |

### MASTERNODEPAYMENTSYNC - "mnget"

Masternode Payment Sync

| Field Size | Field Name | Data type | Description |
| ---------- | ----------- | --------- | -------- |
| 4 | nMnCount | int |


text:
package org.apache.ignite.spi.discovery.zk;

import junit.framework.TestSuite;
import org.apache.curator.test.ByteCodeRewrite;
import org.apache.ignite.spi.discovery.zk.internal.ZookeeperClientTest;
import org.apache.ignite.spi.discovery.zk.internal.ZookeeperDiscoverySpiSaslFailedAuthTest;
import org.apache.ignite.spi.discovery.zk.internal.ZookeeperDiscoverySpiSaslSuccessfulAuthTest;
import org.apache.ignite.spi.discovery.zk.internal.ZookeeperDiscoverySpiTest;
import org.apache.zookeeper.jmx.MBeanRegistry;
import org.apache.zookeeper.server.ZooKeeperServer;
import org.apache.zookeeper.server.quorum.LearnerZooKeeperServer;

/**
 *
 */
public class ZookeeperDiscoverySpiTestSuite1 extends TestSuite {
    /**
     * During test suite processing GC can unload some classes whose bytecode has been rewritten here
     * {@link ByteCodeRewrite}. And the next time these classes will be loaded without bytecode rewriting.
     *
     * This workaround prevents unloading of these classes.
     *
     * @see Issue link..
     */
    @SuppressWarnings("unused")
    private static final Class[] WORKAROUND;

    static {
        ByteCodeRewrite.apply();

        // GC will not unload this classes.
        WORKAROUND = new Class[] {ZooKeeperServer.class, LearnerZooKeeperServer.class, MBeanRegistry.class};
    }

    /**
     * @return Test suite.
     * @throws Exception Thrown in case of the failure.
     */
    public static TestSuite suite() throws Exception {
        System.setProperty("zookeeper.forceSync", "false");
        System.setProperty("zookeeper.jmx.log4j.disable", "true");

        TestSuite suite = new TestSuite("ZookeeperDiscoverySpi Test Suite");

        suite.addTestSuite(ZookeeperClientTest.class);
        suite.addTestSuite(ZookeeperDiscoverySpiTest.class);
        //suite.addTestSuite(ZookeeperDiscoverySpiSaslFailedAuthTest.class);
        suite.addTestSuite(ZookeeperDiscoverySpiSaslSuccessfulAuthTest.class);

        return suite;
    }
}


text:
package main

import (
	"bytes"
	"encoding/base64"
	"encoding/json"
	"flag"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"text/tabwriter"
	"time"

	"github.com/AlekSi/xattr"
	"github.com/fatih/color"
	"github.com/tv42/httpunix"
)

var (
	LogStaging = "STAGING"
	LogLatest  = "LATEST"
)

var (
	yellow     = color.New(color.FgYellow).SprintFunc()
	yellowBold = color.New(color.FgYellow, color.Bold).SprintFunc()
	bold       = color.New(color.Bold).SprintFunc()
)

type CommitLog struct {
	T       string `json:"t"`
	Ref     string `json:"ref"`
	Comment string `json:"comment"`
	Current bool   `json:"current"`
}

var Usage = func() {
	fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
	fmt.Fprintf(os.Stderr, "  %s COMMAND\n", os.Args[0])
	flag.PrintDefaults()
}

func isPublic(path string) (bool, error) {
	res, err := xattr.Get(path, "public")
	if err != nil {
		if !xattr.IsNotExist(err) {
			return false, err
		}
	} else {
		if string(res) == "1" {
			return true, nil
		}
	}
	return false, nil
}

func main() {
	commentPtr := flag.String("comment", "", "optional commit comment")
	publicPtr := flag.Bool("public", false, "share the node publicly (default to semi-private)")
	// shareTTLPtr := flag.String("share-ttl", "1h", "TTL for the semi-private sharing linl (default to 1h)")

	flag.Usage = Usage
	flag.Parse()

	if flag.NArg() < 1 {
		Usage()
		os.Exit(2)
	}
	cmd := flag.Arg(0)
	rsocket, err := ioutil.ReadFile(".blobfs_socket")
	// TODO(tsileo): do the same for bash

	transport := &httpunix.Transport{
		DialTimeout:           100 * time.Millisecond,
		RequestTimeout:        1 * time.Second,
		ResponseHeaderTimeout: 1 * time.Second,
	}
	transport.RegisterLocation("blobfs", string(rsocket))

	var client = http.Client{
		Transport: transport,
	}
	u := "http+unix://blobfs"
	if cmd == "__ps1_bash" {
		if os.IsNotExist(err) {
			fmt.Printf("")
			return
		}
		request, err := http.NewRequest("GET", fmt.Sprintf("%s%s", u, "/ref"), nil)
		if err != nil {
			return
		}
		resp, err := client.Do(request)
		if err != nil {
			return
		}
		if resp.StatusCode != 200 {
			return
		}
		rr := &RefResp{}
		if err := json.NewDecoder(resp.Body).Decode(rr); err != nil {
			return
		}
		fmt.Printf("%s:(%s) ", bold("blobfs"), yellow(rr.Ref))
		return
	}
	if cmd == "__ps1_zsh" {
		if os.IsNotExist(err) {
			fmt.Printf("")
			return
		}
		// TODO(tsileo): a getRef
		request, err := http.NewRequest("GET", fmt.Sprintf("%s%s", u, "/ref"), nil)
		if err != nil {
			return
		}
		resp, err := client.Do(request)
		if err != nil {
			return
		}
		if resp.StatusCode != 200 {
			return
		}
		rr := &RefResp{}
		if err := json.NewDecoder(resp.Body).Decode(rr); err != nil {
			return
		}
		fmt.Print("%Bblobfs%b:(%{\033[33m%}" + rr.Ref + "%{\033[0m%}) ")
		return
	}
	if err != nil {
		// panic(err)
	}
	url := string(u)
	switch cmd {
	case "checkout":
		if err := Checkout(client, url, flag.Arg(1)); err != nil {
			panic(err)
		}
	case "history", "log":
		if err := Log(client, url); err != nil {
			panic(err)
		}
	case "sync", "push":
		if err := Sync(client, url, *commentPtr); err != nil {
			panic(err)
		}
	case "fetch", "pull":
		if err := Pull(client, url); err != nil {
			panic(err)
		}
	case "debug":
		if err := Debug(client, url); err != nil {
			panic(err)
		}
	case "share":
		path := "."
		if flag.NArg() == 2 {
			path = flag.Arg(1)
		}
		public, err := isPublic(path)
		if err != nil {
			panic(err)
		}
		fmt.Printf("public:%s\n", public)

		// Share in "public" mode
		if *publicPtr {

			if public {
				burl, err := xattr.Get(path, "url")
				if err != nil {
					panic(err)
				}
				fmt.Printf("%s\n", burl)
			} else {
				if err := xattr.Set(path, "public", []byte("1")); err != nil {
					panic(err)
				}
				burl, err := xattr.Get(path, "url")
				if err != nil {
					panic(err)
				}
				fmt.Printf("%s\n", burl)
			}
			fmt.Printf("\nYou still need to commit for the file to become available.")
			return

		}

		// TODO(tsileo): display a special message if a semi-privat link is requested
		// for a node in staging only.

		// Share in semi-private mode (e.g. anyone with the link can access it)
		burl, err := xattr.Get(path, "url.semiprivate")
		if err != nil {
			panic(err)
		}
		fmt.Printf("%s\n", burl)
		fmt.Printf("\nYou still need to make a sync for the file to become available.")

	case "unshare":
		path := "."
		if flag.NArg() == 2 {
			path = flag.Arg(1)
		}
		public, err := isPublic(path)
		if err != nil {
			panic(err)
		}
		fmt.Printf("public:%s\n", public)
		if !public {
			// XXX(tsileo): color in red?
			fmt.Printf("You can only unshare public nodes")
			// TODO(tsileo): return with error code
			return
		}

		if err := xattr.Set(path, "public", []byte("0")); err != nil {
			panic(err)
		}
		fmt.Printf("\nYou still need to commit for the file to become unavailable.")
	case "prune", "public": // XXX(tsileo): find a better name than `public` for listing public nodes
		fmt.Printf("Not implemented yet")
	default:
		fmt.Printf("unknown cmd %v", cmd)
	}
}

type StatusResp struct {
	Added    []string `json:"added"`
	Modified []string `json:"modified"`
	Deleted  []string `json:"deleted"`
}

type RefResp struct {
	Ref string `json:"ref"`
}

func buildStatusIndex(in []string) map[string]struct{} {
	out := map[string]struct{}{}
	for _, path := range in {
		out[path] = struct{}{}
	}
	return out
}

// func Status(client http.Client, u string) error {
// 	request, err := http.NewRequest("GET", fmt.Sprintf("%s%s", u, "/status"), nil)
// 	if err != nil {
// 		return err
// 	}
// 	resp, err := client.Do(request)
// 	if err != nil {
// 		return err
// 	}
// 	if resp.StatusCode == 204 {
// 		return nil
// 	}
// 	if resp.StatusCode != 200 {
// 		return fmt.Errorf("http %d", resp.StatusCode)
// 	}
// 	sr := &StatusResp{}
// 	if err := json.NewDecoder(resp.Body).Decode(sr); err != nil {
// 		return err
// 	}
// 	deletedIndex := buildStatusIndex(sr.Deleted)
// 	modifiedIndex := buildStatusIndex(sr.Modified)
// 	addedIndex := buildStatusIndex(sr.Added)
// 	paths := []string{}
// 	for _, p := range sr.Added {
// 		paths = append(paths, p)
// 	}
// 	for _, p := range sr.Deleted {
// 		paths = append(paths, p)
// 	}
// 	for _, p := range sr.Modified {
// 		paths = append(paths, p)
// 	}
// 	sort.Strings(paths)
// 	for _, p := range paths {
// 		var letter string
// 		if _, ok := addedIndex[p]; ok {
// 			letter = "A"
// 		}
// 		if _, ok := modifiedIndex[p]; ok {
// 			letter = "M"
// 		}
// 		if _, ok := deletedIndex[p]; ok {
// 			letter = "D"
// 		}
// 		fmt.Printf("%s  %s\n", yellow(letter), p)
// 	}
// 	return nil
// }

func Debug(client http.Client, u string) error {
	request, err := http.NewRequest("GET", fmt.Sprintf("%s%s", u, "/debug"), nil)
	if err != nil {
		return err
	}
	resp, err := client.Do(request)
	if err != nil {
		return err
	}
	if resp.StatusCode != 200 {
		return fmt.Errorf("http %d", resp.StatusCode)
	}
	out := map[string]interface{}{}
	if err := json.NewDecoder(resp.Body).Decode(&out); err != nil {
		return err
	}
	displayVersion(out, "local")
	displayVersion(out, "local-remote")
	displayVersion(out, "remote")
	// fmt.Printf("out=%+v\n", out)
	return nil
}

func displayVersion(out map[string]interface{}, k string) {
	d := out[k].(map[string]interface{})
	fmt.Printf("MUTATIONS\n%s=%s\n", k, d["key"])
	for _, ikv := range d["versions"].([]interface{}) {
		kv := ikv.(map[string]interface{})
		fmt.Printf("\tversion=%v\n", int(kv["version"].(float64)))
		data, err := base64.StdEncoding.DecodeString(kv["data"].(string))
		if err != nil {
			panic(err)
		}
		root := map[string]interface{}{}
		if err := json.Unmarshal(data, &root); err != nil {
			panic(err)
		}
		fmt.Printf("\troot=%+v\n\n", root)
	}
}

func Pull(client http.Client, u string) error {
	request, err := http.NewRequest("POST", fmt.Sprintf("%s%s", u, "/pull"), nil)
	if err != nil {
		return err
	}
	resp, err := client.Do(request)
	if err != nil {
		return err
	}
	if resp.StatusCode != 204 {
		return fmt.Errorf("http %d", resp.StatusCode)
	}
	return nil
}

func Sync(client http.Client, u, comment string) error {
	fmt.Printf("comment=%s\n", comment)
	request, err := http.NewRequest("POST", fmt.Sprintf("%s%s", u, "/sync"), bytes.NewReader([]byte(comment)))
	if err != nil {
		return err
	}
	resp, err := client.Do(request)
	if err != nil {
		return err
	}
	if resp.StatusCode != 204 {
		return fmt.Errorf("http %d", resp.StatusCode)
	}
	return nil
}

func Log(client http.Client, u string) error {
	request, err := http.NewRequest("GET", fmt.Sprintf("%s%s", u, "/log"), nil)
	if err != nil {
		return err
	}
	resp, err := client.Do(request)
	if err != nil {
		return err
	}
	if resp.StatusCode != 200 {
		return fmt.Errorf("http %d", resp.StatusCode)
	}
	logs := []*CommitLog{}
	if err := json.NewDecoder(resp.Body).Decode(&logs); err != nil {
		return err
	}
	w := new(tabwriter.Writer)
	w.Init(os.Stdout, 0, 8, 0, '\t', 0)
	for _, log := range logs {
		if log.Current {
			fmt.Fprintf(w, "* %s\t%s\t%s\n", yellow(log.Ref), log.T, log.Comment)
		} else {
			fmt.Fprintf(w, "  %s\t%s\t%s\n", log.Ref, log.T, log.Comment)
		}
	}
	w.Flush()
	return nil
}

func Checkout(client http.Client, u, ref string) error {
	body, err := json.Marshal(map[string]interface{}{"ref": ref})
	if err != nil {
		return err
	}
	request, err := http.NewRequest("POST", fmt.Sprintf("%s%s", u, "/checkout"), bytes.NewReader(body))
	if err != nil {
		return err
	}
	resp, err := client.Do(request)
	if err != nil {
		return err
	}
	if resp.StatusCode == 200 {
		return nil
	}
	return fmt.Errorf("http %d", resp.StatusCode)
}


text:
package org.joverseer.support.infoSources.spells;

/**
 * Information derived from a LA spell.
 * Contains:
 * - the turn number
 * - the nation number of the caster
 * - the caster's name
 * - the hex at which the item was LA'ed
 *
 * @author Marios Skounakis
 *
 */
public class DerivedFromLocateArtifactInfoSource extends DerivedFromSpellInfoSource {
	private static final long serialVersionUID = -2958513297779262354L;

	public DerivedFromLocateArtifactInfoSource(int turnNo, int nationNo, String casterName, int hexNo) {
        setTurnNo(turnNo);
        setNationNo(nationNo);
        setCasterName(casterName);
        setHexNo(hexNo);
    }

    @Override
	public String getSpell() {
        return "LA";
    }
}


text:
package org.apache.metron.common.configuration.profiler;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * The user defined configuration values required to generate a Profile.
 */
public class ProfileConfig implements Serializable {

  /**
   * A unique name identifying the profile.  The field is treated as a string.
   */
  private String profile;

  /**
   * A separate profile is maintained for each of these.  This is effectively the
   * entity that the profile is describing.  The field is expected to contain a
   * Stellar expression whose result is the entity name.  For example, if `ip_src_addr`
   * then a separate profile would be maintained for each unique IP source address in
   * the data; 10.0.0.1, 10.0.0.2, etc.
   */
  private String foreach;

  /**
   * An expression that determines if a message should be applied to the profile.  A
   * Stellar expression is expected that when executed returns a boolean.  A message
   * is only applied to a profile if this condition is true. This allows a profile
   * to filter the messages that it receives.
   */
  private String onlyif;

  /**
   * A set of expressions that is executed at the start of a window period.  A map is
   * expected where the key is the variable name and the value is a Stellar expression.
   * The map can contain 0 or more variables/expressions. At the start of each window
   * period the expression is executed once and stored in a variable with the given
   * name.
   */
  private Map<String, String> init = new HashMap<>();

  /**
   * A set of expressions that is executed when a message is applied to the profile.
   * A map is expected where the key is the variable name and the value is a Stellar
   * expression.  The map can include 0 or more variables/expressions.
   */
  private Map<String, String> update = new HashMap<>();

  /**
   * A list of Stellar expressions that is executed in order and used to group the
   * resulting profile data.
   */
  private List<String> groupBy = new ArrayList<>();

  /**
   * A Stellar expression that is executed when the window period expires.  The
   * expression is expected to in some way summarize the messages that were applied
   * to the profile over the window period.  The expression must result in a numeric
   * value such as a Double, Long, Float, Short, or Integer.
   */
  private String result;

  /**
   * How long the data created by this Profile will be retained.  After this period of time the
   * profile data will be purged and no longer accessible.
   */
  private Long expires;

  public String getProfile() {
    return profile;
  }

  public void setProfile(String profile) {
    this.profile = profile;
  }

  public String getForeach() {
    return foreach;
  }

  public void setForeach(String foreach) {
    this.foreach = foreach;
  }

  public String getOnlyif() {
    return onlyif;
  }

  public void setOnlyif(String onlyif) {
    this.onlyif = onlyif;
  }

  public Map<String, String> getInit() {
    return init;
  }

  public void setInit(Map<String, String> init) {
    this.init = init;
  }

  public Map<String, String> getUpdate() {
    return update;
  }

  public void setUpdate(Map<String, String> update) {
    this.update = update;
  }

  public List<String> getGroupBy() {
    return groupBy;
  }

  public void setGroupBy(List<String> groupBy) {
    this.groupBy = groupBy;
  }

  public String getResult() {
    return result;
  }

  public void setResult(String result) {
    this.result = result;
  }

  public Long getExpires() {
    return expires;
  }

  public void setExpires(Long expiresDays) {
    this.expires = TimeUnit.DAYS.toMillis(expiresDays);
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    ProfileConfig that = (ProfileConfig) o;

    if (profile != null ? !profile.equals(that.profile) : that.profile != null) return false;
    if (foreach != null ? !foreach.equals(that.foreach) : that.foreach != null) return false;
    if (onlyif != null ? !onlyif.equals(that.onlyif) : that.onlyif != null) return false;
    if (init != null ? !init.equals(that.init) : that.init != null) return false;
    if (update != null ? !update.equals(that.update) : that.update != null) return false;
    if (groupBy != null ? !groupBy.equals(that.groupBy) : that.groupBy != null) return false;
    if (result != null ? !result.equals(that.result) : that.result != null) return false;
    return expires != null ? expires.equals(that.expires) : that.expires == null;

  }

  @Override
  public int hashCode() {
    int result1 = profile != null ? profile.hashCode() : 0;
    result1 = 31 * result1 + (foreach != null ? foreach.hashCode() : 0);
    result1 = 31 * result1 + (onlyif != null ? onlyif.hashCode() : 0);
    result1 = 31 * result1 + (init != null ? init.hashCode() : 0);
    result1 = 31 * result1 + (update != null ? update.hashCode() : 0);
    result1 = 31 * result1 + (groupBy != null ? groupBy.hashCode() : 0);
    result1 = 31 * result1 + (result != null ? result.hashCode() : 0);
    result1 = 31 * result1 + (expires != null ? expires.hashCode() : 0);
    return result1;
  }

  @Override
  public String toString() {
    return "ProfileConfig{" +
            "profile='" + profile + '\'' +
            ", foreach='" + foreach + '\'' +
            ", onlyif='" + onlyif + '\'' +
            ", init=" + init +
            ", update=" + update +
            ", groupBy=" + groupBy +
            ", result='" + result + '\'' +
            ", expires=" + expires +
            '}';
  }
}


text:
var graphApp = angular.module('graphApp', ['gridshore.c3js.chart','graphApp.services']);

graphApp.controller('GraphCtrl', function ($scope, $interval,dataService) {
	$scope.datapoints=[];
	$scope.datacolumns=[{"id":"top-1","type":"line","name":"Top one"},
	                    {"id":"top-2","type":"spline","name":"Top two"}];
	$scope.datax={"id":"x"};

	$interval(function(){
		dataService.loadData(function(data){
			$scope.datapoints.push(data);
		});
	},1000,10);
});

var services = angular.module('graphApp.services', []);
services.factory('dataService', function() {
	function DataService() {
		var maxNumber = 200;

		// API methods
		this.loadData = function(callback) {
			callback({"x":new Date(),"top-1":randomNumber(),"top-2":randomNumber()});
		};

		function randomNumber() {
			return Math.floor((Math.random() * maxNumber) + 1);
		}
	}
	return new DataService();
});