text:
;(function(){

/**
 * Require the module at `name`.
 *
 * @param {String} name
 * @return {Object} exports
 * @api public
 */

function require(name) {
  var module = require.modules[name];
  if (!module) throw new Error('failed to require "' + name + '"');

  if (!('exports' in module) && typeof module.definition === 'function') {
    module.client = module.component = true;
    module.definition.call(this, module.exports = {}, module);
    delete module.definition;
  }

  return module.exports;
}

/**
 * Meta info, accessible in the global scope unless you use AMD option.
 */

require.loader = 'component';

/**
 * Internal helper object, contains a sorting function for semantiv versioning
 */
require.helper = {};
require.helper.semVerSort = function(a, b) {
  var aArray = a.version.split('.');
  var bArray = b.version.split('.');
  for (var i=0; i<aArray.length; ++i) {
    var aInt = parseInt(aArray[i], 10);
    var bInt = parseInt(bArray[i], 10);
    if (aInt === bInt) {
      var aLex = aArray[i].substr((""+aInt).length);
      var bLex = bArray[i].substr((""+bInt).length);
      if (aLex === '' && bLex !== '') return 1;
      if (aLex !== '' && bLex === '') return -1;
      if (aLex !== '' && bLex !== '') return aLex > bLex ? 1 : -1;
      continue;
    } else if (aInt > bInt) {
      return 1;
    } else {
      return -1;
    }
  }
  return 0;
}

/**
 * Find and require a module which name starts with the provided name.
 * If multiple modules exists, the highest semver is used.
 * This function can only be used for remote dependencies.

 * @param {String} name - module name: `user~repo`
 * @param {Boolean} returnPath - returns the canonical require path if true,
 *                               otherwise it returns the epxorted module
 */
require.latest = function (name, returnPath) {
  function showError(name) {
    throw new Error('failed to find latest module of "' + name + '"');
  }
  // only remotes with semvers, ignore local files conataining a '/'
  var versionRegexp = /(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/;
  var remoteRegexp = /(.*)~(.*)/;
  if (!remoteRegexp.test(name)) showError(name);
  var moduleNames = Object.keys(require.modules);
  var semVerCandidates = [];
  var otherCandidates = []; // for instance: name of the git branch
  for (var i=0; i<moduleNames.length; i++) {
    var moduleName = moduleNames[i];
    if (new RegExp(name + '@').test(moduleName)) {
        var version = moduleName.substr(name.length+1);
        var semVerMatch = versionRegexp.exec(moduleName);
        if (semVerMatch != null) {
          semVerCandidates.push({version: version, name: moduleName});
        } else {
          otherCandidates.push({version: version, name: moduleName});
        }
    }
  }
  if (semVerCandidates.concat(otherCandidates).length === 0) {
    showError(name);
  }
  if (semVerCandidates.length > 0) {
    var module = semVerCandidates.sort(require.helper.semVerSort).pop().name;
    if (returnPath === true) {
      return module;
    }
    return require(module);
  }
  // if the build contains more than one branch of the same module
  // you should not use this funciton
  var module = otherCandidates.sort(function(a, b) {return a.name > b.name})[0].name;
  if (returnPath === true) {
    return module;
  }
  return require(module);
}

/**
 * Registered modules.
 */

require.modules = {};

/**
 * Register module at `name` with callback `definition`.
 *
 * @param {String} name
 * @param {Function} definition
 * @api private
 */

require.register = function (name, definition) {
  require.modules[name] = {
    definition: definition
  };
};

/**
 * Define a module's exports immediately with `exports`.
 *
 * @param {String} name
 * @param {Generic} exports
 * @api private
 */

require.define = function (name, exports) {
  require.modules[name] = {
    exports: exports
  };
};
require.register("component~transform-property@0.0.1", function (exports, module) {

var styles = [
  'webkitTransform',
  'MozTransform',
  'msTransform',
  'OTransform',
  'transform'
];

var el = document.createElement('p');
var style;

for (var i = 0; i < styles.length; i++) {
  style = styles[i];
  if (null != el.style[style]) {
    module.exports = style;
    break;
  }
}

});

require.register("component~has-translate3d@0.0.3", function (exports, module) {

var prop = require('component~transform-property@0.0.1');

// IE <=8 doesn't have `getComputedStyle`
if (!prop || !window.getComputedStyle) {
  module.exports = false;

} else {
  var map = {
    webkitTransform: '-webkit-transform',
    OTransform: '-o-transform',
    msTransform: '-ms-transform',
    MozTransform: '-moz-transform',
    transform: 'transform'
  };

  // from: https://gist.github.com/lorenzopolidori/3794226
  var el = document.createElement('div');
  el.style[prop] = 'translate3d(1px,1px,1px)';
  document.body.insertBefore(el, null);
  var val = getComputedStyle(el).getPropertyValue(map[prop]);
  document.body.removeChild(el);
  module.exports = null != val && val.length && 'none' != val;
}

});

require.register("yields~has-transitions@1.0.0", function (exports, module) {
/**
 * Check if `el` or browser supports transitions.
 *
 * @param {Element} el
 * @return {Boolean}
 * @api public
 */

exports = module.exports = function(el){
  switch (arguments.length) {
    case 0: return bool;
    case 1: return bool
      ? transitions(el)
      : bool;
  }
};

/**
 * Check if the given `el` has transitions.
 *
 * @param {Element} el
 * @return {Boolean}
 * @api private
 */

function transitions(el, styl){
  if (el.transition) return true;
  styl = window.getComputedStyle(el);
  return !! parseFloat(styl.transitionDuration, 10);
}

/**
 * Style.
 */

var styl = document.body.style;

/**
 * Export support.
 */

var bool = 'transition' in styl
  || 'webkitTransition' in styl
  || 'MozTransition' in styl
  || 'msTransition' in styl;

});

require.register("component~event@0.1.4", function (exports, module) {
var bind = window.addEventListener ? 'addEventListener' : 'attachEvent',
    unbind = window.removeEventListener ? 'removeEventListener' : 'detachEvent',
    prefix = bind !== 'addEventListener' ? 'on' : '';

/**
 * Bind `el` event `type` to `fn`.
 *
 * @param {Element} el
 * @param {String} type
 * @param {Function} fn
 * @param {Boolean} capture
 * @return {Function}
 * @api public
 */

exports.bind = function(el, type, fn, capture){
  el[bind](prefix + type, fn, capture || false);
  return fn;
};

/**
 * Unbind `el` event `type`'s callback `fn`.
 *
 * @param {Element} el
 * @param {String} type
 * @param {Function} fn
 * @param {Boolean} capture
 * @return {Function}
 * @api public
 */

exports.unbind = function(el, type, fn, capture){
  el[unbind](prefix + type, fn, capture || false);
  return fn;
};
});

require.register("ecarter~css-emitter@0.0.1", function (exports, module) {
/**
 * Module Dependencies
 */

var events = require('component~event@0.1.4');

// CSS events

var watch = [
  'transitionend'
, 'webkitTransitionEnd'
, 'oTransitionEnd'
, 'MSTransitionEnd'
, 'animationend'
, 'webkitAnimationEnd'
, 'oAnimationEnd'
, 'MSAnimationEnd'
];

/**
 * Expose `CSSnext`
 */

module.exports = CssEmitter;

/**
 * Initialize a new `CssEmitter`
 *
 */

function CssEmitter(element){
  if (!(this instanceof CssEmitter)) return new CssEmitter(element);
  this.el = element;
}

/**
 * Bind CSS events.
 *
 * @api public
 */

CssEmitter.prototype.bind = function(fn){
  for (var i=0; i < watch.length; i++) {
    events.bind(this.el, watch[i], fn);
  }
  return this;
};

/**
 * Unbind CSS events
 *
 * @api public
 */

CssEmitter.prototype.unbind = function(fn){
  for (var i=0; i < watch.length; i++) {
    events.unbind(this.el, watch[i], fn);
  }
  return this;
};

/**
 * Fire callback only once
 *
 * @api public
 */

CssEmitter.prototype.once = function(fn){
  var self = this;
  function on(){
    self.unbind(on);
    fn.apply(self.el, arguments);
  }
  self.bind(on);
  return this;
};

});

require.register("component~once@0.0.1", function (exports, module) {

/**
 * Identifier.
 */

var n = 0;

/**
 * Global.
 */

var global = (function(){ return this })();

/**
 * Make `fn` callable only once.
 *
 * @param {Function} fn
 * @return {Function}
 * @api public
 */

module.exports = function(fn) {
  var id = n++;

  function once(){
    // no receiver
    if (this == global) {
      if (once.called) return;
      once.called = true;
      return fn.apply(this, arguments);
    }

    // receiver
    var key = '__called_' + id + '__';
    if (this[key]) return;
    this[key] = true;
    return fn.apply(this, arguments);
  }

  return once;
};

});

require.register("yields~after-transition@0.0.1", function (exports, module) {

/**
 * dependencies
 */

var has = require('yields~has-transitions@1.0.0')
  , emitter = require('ecarter~css-emitter@0.0.1')
  , once = require('component~once@0.0.1');

/**
 * Transition support.
 */

var supported = has();

/**
 * Export `after`
 */

module.exports = after;

/**
 * Invoke the given `fn` after transitions
 *
 * It will be invoked only if the browser
 * supports transitions __and__
 * the element has transitions
 * set in `.style` or css.
 *
 * @param {Element} el
 * @param {Function} fn
 * @return {Function} fn
 * @api public
 */

function after(el, fn){
  if (!supported || !has(el)) return fn();
  emitter(el).bind(fn);
  return fn;
};

/**
 * Same as `after()` only the function is invoked once.
 *
 * @param {Element} el
 * @param {Function} fn
 * @return {Function}
 * @api public
 */

after.once = function(el, fn){
  var callback = once(fn);
  after(el, fn = function(){
    emitter(el).unbind(fn);
    callback();
  });
};

});

require.register("component~emitter@1.2.0", function (exports, module) {

/**
 * Expose `Emitter`.
 */

module.exports = Emitter;

/**
 * Initialize a new `Emitter`.
 *
 * @api public
 */

function Emitter(obj) {
  if (obj) return mixin(obj);
};

/**
 * Mixin the emitter properties.
 *
 * @param {Object} obj
 * @return {Object}
 * @api private
 */

function mixin(obj) {
  for (var key in Emitter.prototype) {
    obj[key] = Emitter.prototype[key];
  }
  return obj;
}

/**
 * Listen on the given `event` with `fn`.
 *
 * @param {String} event
 * @param {Function} fn
 * @return {Emitter}
 * @api public
 */

Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
  this._callbacks = this._callbacks || {};
  (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
    .push(fn);
  return this;
};

/**
 * Adds an `event` listener that will be invoked a single
 * time then automatically removed.
 *
 * @param {String} event
 * @param {Function} fn
 * @return {Emitter}
 * @api public
 */

Emitter.prototype.once = function(event, fn){
  function on() {
    this.off(event, on);
    fn.apply(this, arguments);
  }

  on.fn = fn;
  this.on(event, on);
  return this;
};

/**
 * Remove the given callback for `event` or all
 * registered callbacks.
 *
 * @param {String} event
 * @param {Function} fn
 * @return {Emitter}
 * @api public
 */

Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
  this._callbacks = this._callbacks || {};

  // all
  if (0 == arguments.length) {
    this._callbacks = {};
    return this;
  }

  // specific event
  var callbacks = this._callbacks['$' + event];
  if (!callbacks) return this;

  // remove all handlers
  if (1 == arguments.length) {
    delete this._callbacks['$' + event];
    return this;
  }

  // remove specific handler
  var cb;
  for (var i = 0; i < callbacks.length; i++) {
    cb = callbacks[i];
    if (cb === fn || cb.fn === fn) {
      callbacks.splice(i, 1);
      break;
    }
  }
  return this;
};

/**
 * Emit `event` with the given args.
 *
 * @param {String} event
 * @param {Mixed} ...
 * @return {Emitter}
 */

Emitter.prototype.emit = function(event){
  this._callbacks = this._callbacks || {};
  var args = [].slice.call(arguments, 1)
    , callbacks = this._callbacks['$' + event];

  if (callbacks) {
    callbacks = callbacks.slice(0);
    for (var i = 0, len = callbacks.length; i < len; ++i) {
      callbacks[i].apply(this, args);
    }
  }

  return this;
};

/**
 * Return array of callbacks for `event`.
 *
 * @param {String} event
 * @return {Array}
 * @api public
 */

Emitter.prototype.listeners = function(event){
  this._callbacks = this._callbacks || {};
  return this._callbacks['$' + event] || [];
};

/**
 * Check if this emitter has `event` handlers.
 *
 * @param {String} event
 * @return {Boolean}
 * @api public
 */

Emitter.prototype.hasListeners = function(event){
  return !! this.listeners(event).length;
};

});

require.register("yields~css-ease@0.0.1", function (exports, module) {

/**
 * CSS Easing functions
 */

module.exports = {
    'in':                'ease-in'
  , 'out':               'ease-out'
  , 'in-out':            'ease-in-out'
  , 'snap':              'cubic-bezier(0,1,.5,1)'
  , 'linear':            'cubic-bezier(0.250, 0.250, 0.750, 0.750)'
  , 'ease-in-quad':      'cubic-bezier(0.550, 0.085, 0.680, 0.530)'
  , 'ease-in-cubic':     'cubic-bezier(0.550, 0.055, 0.675, 0.190)'
  , 'ease-in-quart':     'cubic-bezier(0.895, 0.030, 0.685, 0.220)'
  , 'ease-in-quint':     'cubic-bezier(0.755, 0.050, 0.855, 0.060)'
  , 'ease-in-sine':      'cubic-bezier(0.470, 0.000, 0.745, 0.715)'
  , 'ease-in-expo':      'cubic-bezier(0.950, 0.050, 0.795, 0.035)'
  , 'ease-in-circ':      'cubic-bezier(0.600, 0.040, 0.980, 0.335)'
  , 'ease-in-back':      'cubic-bezier(0.600, -0.280, 0.735, 0.045)'
  , 'ease-out-quad':     'cubic-bezier(0.250, 0.460, 0.450, 0.940)'
  , 'ease-out-cubic':    'cubic-bezier(0.215, 0.610, 0.355, 1.000)'
  , 'ease-out-quart':    'cubic-bezier(0.165, 0.840, 0.440, 1.000)'
  , 'ease-out-quint':    'cubic-bezier(0.230, 1.000, 0.320, 1.000)'
  , 'ease-out-sine':     'cubic-bezier(0.390, 0.575, 0.565, 1.000)'
  , 'ease-out-expo':     'cubic-bezier(0.190, 1.000, 0.220, 1.000)'
  , 'ease-out-circ':     'cubic-bezier(0.075, 0.820, 0.165, 1.000)'
  , 'ease-out-back':     'cubic-bezier(0.175, 0.885, 0.320, 1.275)'
  , 'ease-out-quad':     'cubic-bezier(0.455, 0.030, 0.515, 0.955)'
  , 'ease-out-cubic':    'cubic-bezier(0.645, 0.045, 0.355, 1.000)'
  , 'ease-in-out-quart': 'cubic-bezier(0.770, 0.000, 0.175, 1.000)'
  , 'ease-in-out-quint': 'cubic-bezier(0.860, 0.000, 0.070, 1.000)'
  , 'ease-in-out-sine':  'cubic-bezier(0.445, 0.050, 0.550, 0.950)'
  , 'ease-in-out-expo':  'cubic-bezier(1.000, 0.000, 0.000, 1.000)'
  , 'ease-in-out-circ':  'cubic-bezier(0.785, 0.135, 0.150, 0.860)'
  , 'ease-in-out-back':  'cubic-bezier(0.680, -0.550, 0.265, 1.550)'
};

});

require.register("component~query@0.0.3", function (exports, module) {
function one(selector, el) {
  return el.querySelector(selector);
}

exports = module.exports = function(selector, el){
  el = el || document;
  return one(selector, el);
};

exports.all = function(selector, el){
  el = el || document;
  return el.querySelectorAll(selector);
};

exports.engine = function(obj){
  if (!obj.one) throw new Error('.one callback required');
  if (!obj.all) throw new Error('.all callback required');
  one = obj.one;
  exports.all = obj.all;
  return exports;
};

});

require.register("move", function (exports, module) {
/**
 * Module Dependencies.
 */

var Emitter = require('component~emitter@1.2.0');
var query = require('component~query@0.0.3');
var after = require('yields~after-transition@0.0.1');
var has3d = require('component~has-translate3d@0.0.3');
var ease = require('yields~css-ease@0.0.1');

/**
 * CSS Translate
 */

var translate = has3d
  ? ['translate3d(', ', 0)']
  : ['translate(', ')'];

/**
 * Export `Move`
 */

module.exports = Move;

/**
 * Get computed style.
 */

var style = window.getComputedStyle
  || window.currentStyle;

/**
 * Library version.
 */

Move.version = '0.5.0';

/**
 * Export `ease`
 */

Move.ease = ease;

/**
 * Defaults.
 *
 *   `duration` - default duration of 500ms
 *
 */

Move.defaults = {
  duration: 500
};

/**
 * Default element selection utilized by `move(selector)`.
 *
 * Override to implement your own selection, for example
 * with jQuery one might write:
 *
 *     move.select = function(selector) {
 *       return jQuery(selector).get(0);
 *     };
 *
 * @param {Object|String} selector
 * @return {Element}
 * @api public
 */

Move.select = function(selector){
  if ('string' != typeof selector) return selector;
  return query(selector);
};

/**
 * Initialize a new `Move` with the given `el`.
 *
 * @param {Element} el
 * @api public
 */

function Move(el) {
  if (!(this instanceof Move)) return new Move(el);
  if ('string' == typeof el) el = query(el);
  if (!el) throw new TypeError('Move must be initialized with element or selector');
  this.el = el;
  this._props = {};
  this._rotate = 0;
  this._transitionProps = [];
  this._transforms = [];
  this.duration(Move.defaults.duration)
};

/**
 * Inherit from `EventEmitter.prototype`.
 */

Emitter(Move.prototype);

/**
 * Buffer `transform`.
 *
 * @param {String} transform
 * @return {Move} for chaining
 * @api private
 */

Move.prototype.transform = function(transform){
  this._transforms.push(transform);
  return this;
};

/**
 * Skew `x` and `y`.
 *
 * @param {Number} x
 * @param {Number} y
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.skew = function(x, y){
  return this.transform('skew('
    + x + 'deg, '
    + (y || 0)
    + 'deg)');
};

/**
 * Skew x by `n`.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.skewX = function(n){
  return this.transform('skewX(' + n + 'deg)');
};

/**
 * Skew y by `n`.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.skewY = function(n){
  return this.transform('skewY(' + n + 'deg)');
};

/**
 * Translate `x` and `y` axis.
 *
 * @param {Number} x
 * @param {Number} y
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.translate =
Move.prototype.to = function(x, y){
  return this.transform(translate.join(''
    + x +'px, '
    + (y || 0)
    + 'px'));
};

/**
 * Translate on the x axis to `n`.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.translateX =
Move.prototype.x = function(n){
  return this.transform('translateX(' + n + 'px)');
};

/**
 * Translate on the y axis to `n`.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.translateY =
Move.prototype.y = function(n){
  return this.transform('translateY(' + n + 'px)');
};

/**
 * Scale the x and y axis by `x`, or
 * individually scale `x` and `y`.
 *
 * @param {Number} x
 * @param {Number} y
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.scale = function(x, y){
  return this.transform('scale('
    + x + ', '
    + (y || x)
    + ')');
};

/**
 * Scale x axis by `n`.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.scaleX = function(n){
  return this.transform('scaleX(' + n + ')')
};

/**
 * Apply a matrix transformation
 *
 * @param {Number} m11 A matrix coefficient
 * @param {Number} m12 A matrix coefficient
 * @param {Number} m21 A matrix coefficient
 * @param {Number} m22 A matrix coefficient
 * @param {Number} m31 A matrix coefficient
 * @param {Number} m32 A matrix coefficient
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.matrix = function(m11, m12, m21, m22, m31, m32){
  return this.transform('matrix(' + [m11,m12,m21,m22,m31,m32].join(',') + ')');
};

/**
 * Scale y axis by `n`.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.scaleY = function(n){
  return this.transform('scaleY(' + n + ')')
};

/**
 * Rotate `n` degrees.
 *
 * @param {Number} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.rotate = function(n){
  return this.transform('rotate(' + n + 'deg)');
};

/**
 * Set transition easing function to to `fn` string.
 *
 * When:
 *
 *   - null "ease" is used
 *   - "in" "ease-in" is used
 *   - "out" "ease-out" is used
 *   - "in-out" "ease-in-out" is used
 *
 * @param {String} fn
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.ease = function(fn){
  fn = ease[fn] || fn || 'ease';
  return this.setVendorProperty('transition-timing-function', fn);
};

/**
 * Set animation properties
 *
 * @param {String} name
 * @param {Object} props
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.animate = function(name, props){
  for (var i in props){
    if (props.hasOwnProperty(i)){
      this.setVendorProperty('animation-' + i, props[i])
    }
  }
  return this.setVendorProperty('animation-name', name);
}

/**
 * Set duration to `n`.
 *
 * @param {Number|String} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.duration = function(n){
  n = this._duration = 'string' == typeof n
    ? parseFloat(n) * 1000
    : n;
  return this.setVendorProperty('transition-duration', n + 'ms');
};

/**
 * Delay the animation by `n`.
 *
 * @param {Number|String} n
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.delay = function(n){
  n = 'string' == typeof n
    ? parseFloat(n) * 1000
    : n;
  return this.setVendorProperty('transition-delay', n + 'ms');
};

/**
 * Set `prop` to `val`, deferred until `.end()` is invoked.
 *
 * @param {String} prop
 * @param {String} val
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.setProperty = function(prop, val){
  this._props[prop] = val;
  return this;
};

/**
 * Set a vendor prefixed `prop` with the given `val`.
 *
 * @param {String} prop
 * @param {String} val
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.setVendorProperty = function(prop, val){
  this.setProperty('-webkit-' + prop, val);
  this.setProperty('-moz-' + prop, val);
  this.setProperty('-ms-' + prop, val);
  this.setProperty('-o-' + prop, val);
  return this;
};

/**
 * Set `prop` to `value`, deferred until `.end()` is invoked
 * and adds the property to the list of transition props.
 *
 * @param {String} prop
 * @param {String} val
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.set = function(prop, val){
  if (typeof prop == "object") {
    for (var key in prop) {
      if (prop.hasOwnProperty(key)) {
        this.transition(key);
        this._props[key] = prop[key];
      }
    }
  } else {
    this.transition(prop);
    this._props[prop] = val;
  }
  return this;
};

/**
 * Increment `prop` by `val`, deferred until `.end()` is invoked
 * and adds the property to the list of transition props.
 *
 * @param {String} prop
 * @param {Number} val
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.add = function(prop, val){
  if (!style) return;
  var self = this;
  return this.on('start', function(){
    var curr = parseInt(self.current(prop), 10);
    self.set(prop, curr + val + 'px');
  });
};

/**
 * Decrement `prop` by `val`, deferred until `.end()` is invoked
 * and adds the property to the list of transition props.
 *
 * @param {String} prop
 * @param {Number} val
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.sub = function(prop, val){
  if (!style) return;
  var self = this;
  return this.on('start', function(){
    var curr = parseInt(self.current(prop), 10);
    self.set(prop, curr - val + 'px');
  });
};

/**
 * Get computed or "current" value of `prop`.
 *
 * @param {String} prop
 * @return {String}
 * @api public
 */

Move.prototype.current = function(prop){
  return style(this.el).getPropertyValue(prop);
};

/**
 * Add `prop` to the list of internal transition properties.
 *
 * @param {String} prop
 * @return {Move} for chaining
 * @api private
 */

Move.prototype.transition = function(prop){
  if (!this._transitionProps.indexOf(prop)) return this;
  this._transitionProps.push(prop);
  return this;
};

/**
 * Commit style properties, aka apply them to `el.style`.
 *
 * @return {Move} for chaining
 * @see Move#end()
 * @api private
 */

Move.prototype.applyProperties = function(){
  for (var prop in this._props) {
    this.el.style.setProperty(prop, this._props[prop], '');
  }
  return this;
};

/**
 * Re-select element via `selector`, replacing
 * the current element.
 *
 * @param {String} selector
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.move =
Move.prototype.select = function(selector){
  this.el = Move.select(selector);
  return this;
};

/**
 * Defer the given `fn` until the animation
 * is complete. `fn` may be one of the following:
 *
 *   - a function to invoke
 *   - an instanceof `Move` to call `.end()`
 *   - nothing, to return a clone of this `Move` instance for chaining
 *
 * @param {Function|Move} fn
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.then = function(fn){
  // invoke .end()
  if (fn instanceof Move) {
    this.on('end', function(){
      fn.end();
    });
  // callback
  } else if ('function' == typeof fn) {
    this.on('end', fn);
  // chain
  } else {
    var clone = new Move(this.el);
    clone._transforms = this._transforms.slice(0);
    this.then(clone);
    clone.parent = this;
    return clone;
  }

  return this;
};

/**
 * Pop the move context.
 *
 * @return {Move} parent Move
 * @api public
 */

Move.prototype.pop = function(){
  return this.parent;
};

/**
 * Reset duration.
 *
 * @return {Move}
 * @api public
 */

Move.prototype.reset = function(){
  this.el.style.webkitTransitionDuration =
  this.el.style.mozTransitionDuration =
  this.el.style.msTransitionDuration =
  this.el.style.oTransitionDuration = '';
  return this;
};

/**
 * Start animation, optionally calling `fn` when complete.
 *
 * @param {Function} fn
 * @return {Move} for chaining
 * @api public
 */

Move.prototype.end = function(fn){
  var self = this;

  // emit "start" event
  this.emit('start');

  // transforms
  if (this._transforms.length) {
    this.setVendorProperty('transform', this._transforms.join(' '));
  }

  // transition properties
  this.setVendorProperty('transition-properties', this._transitionProps.join(', '));
  this.applyProperties();

  // callback given
  if (fn) this.then(fn);

  // emit "end" when complete
  after.once(this.el, function(){
    self.reset();
    self.emit('end');
  });

  return this;
};

});

if (typeof exports == "object") {
  module.exports = require("move");
} else if (typeof define == "function" && define.amd) {
  define("move", [], function(){ return require("move"); });
} else {
  (this || window)["move"] = require("move");
}
})()


text:
@implementation YKCandlePointModel

+ (YKCandlePointModel *)candlePointModelWithOpoint:(CGPoint)oPoint
                                            Hpoint:(CGPoint)hPoint
                                            Lpoint:(CGPoint)lPoint
                                            Cpoint:(CGPoint)cPoint
{
    YKCandlePointModel * model = [YKCandlePointModel new];
    model.oPoint = oPoint;
    model.hPoint = hPoint;
    model.lPoint = lPoint;
    model.cPoint = cPoint;

    return model;
}

@end

redpajama_set_name: RedPajamaGithub


text:
@implementation SFLamp

-(BOOL)loadInfo:(SFTokens*)tokens{

    if (tokens->tokenIs("t")) {
        _type = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("l")) {
        _transform->loc()->setFloats(tokens->valueAsFloats(3), 3);
        return YES;
    }
    if (tokens->tokenIs("d")) {
        _transform->dir()->setFloats(tokens->valueAsFloats(3), 3);
        return YES;
    }
    if (tokens->tokenIs("c")) {
        _colour->setFloats(tokens->valueAsFloats(3), 3);
        return YES;
    }
    if (tokens->tokenIs("n")) {
        _nrg = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("ds")) {
        _dst = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("f")) {
        _fov = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("sb")) {
        _sblend = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("at1")) {
        _att1 = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("at2")) {
        _att2 = tokens->valueAsFloats(1)[0];
        return YES;
    }
    if (tokens->tokenIs("ip")) {
        _ipoName = [[[NSString stringWithUTF8String:tokens->valueAsString()] lastPathComponent] retain];
        return YES;
    }

    return NO;
}

-(id)initCopyWithDictionary:(NSDictionary *)dictionary{
    self = [super initCopyWithDictionary:dictionary];
    if (self != nil) {
        _transform = new SFTransform();
        _colour = new SFColour(COLOUR_SOLID_WHITE);
        _vis = 1;
    }
    return self;
}

-(id)initWithDictionary:(NSDictionary *)dictionary{
    self = [super initWithDictionary:dictionary];
    if (self != nil) {
#if DEBUG_SHOW_LAMP
        [self notifyMe:SF_NOTIFY_DRAW_DEBUG_NOW selector:@selector(debugDrawLamp:)];
#endif
    }
    return self;
}

-(void)cleanUp{
    delete _transform;
    delete _colour;
    [super cleanUp];
}

-(void)renderIpo{
    if (_ipo && [_ipo isPlaying] )
	{
		//SFVec v;
//
//		memcpy( _SIO2lamp->_SIO2transform->loc,
//               _SIO2lamp->_SIO2ipo->_SIO2transform->loc, 12 );
//
//		sio2Rotate3D( _SIO2lamp->_SIO2transform->loc,
//                     90.0f - _SIO2lamp->_SIO2ipo->_SIO2transform->rot->x,
//                     _SIO2lamp->_SIO2ipo->_SIO2transform->rot->z,
//                     -1.0f,
//                     &v );
//
//		sio2SFVecDiff( &v,
//                     ( SFVec *)_SIO2lamp->_SIO2transform->loc,
//                     ( SFVec *)_SIO2lamp->_SIO2transform->dir );
	}
}

+(NSString*)fileDirectory{
    return @"lamp";
}

-(void)debugDrawLamp:(id)notify{
    //draw a yellow box around the lamp's location
//    float x, y, z;
//
//    sio2Project([[_transform loc] getX],
//                [[_transform loc] getY],
//                [[_transform loc] getZ],
//                [[_scene selectedCamera] matModelView],
//                [[_scene selectedCamera] matProjection],
//                [[SFGameEngine sfWindow] matViewPort], &x, &y, &z);
//    SFGL::instance()->glPushMatrix();
//    SFGL::instance()->enter2d(0.0f, 1000.0f);
//    [SFUtils drawGlBox:[SFRect rectWithPosition:[SFVec vectorWithVec2:(vec2){x,y}]
//                                          width:30
//                                         height:30
//                                       centered:YES]
//                colour:DIFFUSE_COLOUR_SOLID_YELLOW];
//    SFGL::instance()->leave2d();
//    SFGL::instance()->glPopMatrix();
}

-(void)switchOn{
    _vis = 1;
}

-(void)switchOff{
    _vis = 0;
}

-(void)render:(int)renderAsLampNumber{

	_index = GL_LIGHT0 + renderAsLampNumber;

	[self renderIpo];

	if( !_vis )
	{ return; }

    SFGL::instance()->glEnable(_index);

	if (_type == SF_LAMP_SUN){
        SFGL::instance()->glLightfv(_index, GL_POSITION, _transform->dir()->floatArray());
    } else {

		_transform->loc()->setW(1.0f); //set uni-directional
		SFGL::instance()->glLightfv(_index, GL_POSITION, _transform->loc()->floatArray());

		if (_type == SF_LAMP_SPOT){
			SFGL::instance()->glLightfv(_index, GL_SPOT_DIRECTION, _transform->dir()->floatArray());
            SFGL::instance()->glLightf(_index, GL_SPOT_CUTOFF, _fov * 0.5f);
            SFGL::instance()->glLightf(_index, GL_SPOT_EXPONENT, 128.0f * _sblend);
		} else {
            SFGL::instance()->glLightf(_index, GL_SPOT_CUTOFF, 180.0f);
        }
	}

    SFGL::instance()->glLightf(_index, GL_CONSTANT_ATTENUATION, 1.0f);
    SFGL::instance()->glLightf(_index, GL_LINEAR_ATTENUATION, _att1 / _dst);
    SFGL::instance()->glLightf(_index, GL_QUADRATIC_ATTENUATION, _att2 / ( _dst * _dst ));

    SFVec *scaledColour = _colour->copy();
    scaledColour->scale(_nrg);
    scaledColour->setW(1.0f);

    static GLfloat diffuseColourBlack[4] = {0.0f, 0.0f, 0.0f, 1.0f};

	if ([self flagState: SF_LAMP_NO_DIFFUSE]){
        SFGL::instance()->glLightfv(_index, GL_DIFFUSE, diffuseColourBlack);
    } else {
        SFGL::instance()->glLightfv(_index, GL_DIFFUSE, scaledColour->floatArray());
    }

	if ([self flagState: SF_LAMP_NO_SPECULAR]){
        SFGL::instance()->glLightfv(_index, GL_SPECULAR, diffuseColourBlack);
    } else {
        SFGL::instance()->glLightfv(_index, GL_SPECULAR, scaledColour->floatArray());
    }

    delete scaledColour;
}

@end


text:
"""
    setup.py

    Copyright (c) 2010 David Martinez Marti
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:
    1. Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.
    3. Neither the name of copyright holders nor the names of its
       contributors may be used to endorse or promote products derived
       from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
    BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.

"""

from distutils.core import setup

setup(
    name = 'bjsonrpc',
    version = '0.2.1',
    description = 'Asynchronous Bidirectional JSON-RPC protocol implementation over TCP/IP',
    long_description = """
        *bjsonrpc* is a implementation of the well-known JSON-RPC protocol
        over TCP-IP with lots of features. It is aimed at speed and simplicity and
        it adds some other extensions to JSON-RPC that makes *bjsonrpc* a very
        powerful tool as a IPC mechanism over low bandwidth.
    """,
    author = 'David Martinez Marti',
    author_email = 'deavidsedice@gmail.com',
    url = 'http://bjsonrpc.wordpress.com/',
    classifiers = [
        "Development Status :: 5 - Production/Stable",
        "Intended Audience :: Developers",
        "License :: DFSG approved",
        "License :: OSI Approved :: BSD License",
        "Natural Language :: English",
        "Operating System :: OS Independent",
        "Programming Language :: Python :: 2",
        "Programming Language :: Python :: 2.5",
        "Programming Language :: Python :: 2.6",
        "Topic :: Communications",
        "Topic :: Software Development :: Libraries :: Python Modules",
        "Topic :: Software Development :: Object Brokering",
    ],
    packages = ['bjsonrpc']
)


text:
package com.demo.common.model;

import com.demo.common.model.base.BaseBlog;
import com.jfinal.plugin.activerecord.Page;

/**
 * Generated by JFinal.
 * Blog1 model.
 * 数据库字段名建议使用驼峰命名规则,便于与 java 代码保持一致,如字段名: userId
 */
@SuppressWarnings("serial")
public class Blog1 extends BaseBlog<Blog1> {

    public static final Blog1 me = new Blog1();

    /**
     * 所有 sql 与业务逻辑写在 Model 或 Service 中,不要写在 Controller 中,养成好习惯,有利于大型项目的开发与维护
     */
    public Page<Blog1> paginate(int pageNumber, int pageSize) {
        return paginate(pageNumber, pageSize, "select *", "from blog order by id asc");
    }
}


text:
#if !defined(FUSION_INCLUDE_FUSED_FUNCTION_OBJECT)
#define FUSION_INCLUDE_FUSED_FUNCTION_OBJECT

#include <lslboost/fusion/functional/adapter/fused_function_object.hpp>

#endif


text:
package CrackingCoding;

import java.util.Arrays;
import java.util.Comparator;

public class c11_2 {
    public static class AnagramComparator implements Comparator<String> {
        public String sortChars(String s) {
            char[] content = s.toCharArray();
            Arrays.sort(content);
            return new String(content);
        }

        public int compare(String s1, String s2) {
            return sortChars(s1).compareTo(sortChars(s2));
        }
    }

    public static void main(String[] args) {
        String[] array = {"apple", "banana", "carrot", "ele", "duck", "papel",
                "tarroc", "cudk", "eel", "lee"};
        System.out.println(AssortedMethods.stringArrayToString(array));
        Arrays.sort(array, new AnagramComparator());
        System.out.println(AssortedMethods.stringArrayToString(array));
    }
}


text:
package com.alibaba.android.arouter.compiler.utils;

import javax.annotation.processing.Messager;
import javax.tools.Diagnostic;
import org.apache.commons.lang3.StringUtils;

/**
 * Simplify the messager.
 *
 * @author Alex Contact me.
 * @version 1.0
 * @since 16/8/22 上午11:48
 */
public class Logger {
    private Messager msg;

    public Logger(Messager messager) {
        msg = messager;
    }

    /**
     * Print info log.
     */
    public void info(CharSequence info) {
        if (StringUtils.isNotEmpty(info)) {
            msg.printMessage(Diagnostic.Kind.NOTE, Consts.PREFIX_OF_LOGGER + info);
        }
    }

    public void error(CharSequence error) {
        if (StringUtils.isNotEmpty(error)) {
            msg.printMessage(Diagnostic.Kind.ERROR,
                Consts.PREFIX_OF_LOGGER + "An exception is encountered, [" + error + "]");
        }
    }

    public void error(Throwable error) {
        if (null != error) {
            msg.printMessage(Diagnostic.Kind.ERROR,
                Consts.PREFIX_OF_LOGGER + "An exception is encountered, [" + error.getMessage() +
                    "]" + "\n" + formatStackTrace(error.getStackTrace()));
        }
    }

    public void warning(CharSequence warning) {
        if (StringUtils.isNotEmpty(warning)) {
            msg.printMessage(Diagnostic.Kind.WARNING, Consts.PREFIX_OF_LOGGER + warning);
        }
    }

    private String formatStackTrace(StackTraceElement[] stackTrace) {
        StringBuilder sb = new StringBuilder();
        for (StackTraceElement element : stackTrace) {
            sb.append("    at ").append(element.toString());
            sb.append("\n");
        }
        return sb.toString();
    }
}


text:
This is a simple script which uses the Nike+ API to retrieve RUNNING activities, update those activities with GPS coordinates (if applicable), writes the information in a single-line, JSON formatted file, then uploads the file to an S3 bucket of your choice.

## Getting Started

Before you run the script, ensure you have the following:
* An API access token from Nike+. Technically one should use API keys, but as far as I can tell, these are only open to
[partners](https://developer.nike.com/contact-us.html). To work around this, you can simply [log in](https://developer.nike.com/content/nike-developer-cq/us/en_us/index/login.html), then use something like Chrome developer tools to go to Application -> Storage -> Local Storage -> https://api.nike.com/, and look for the *_access_token key and corresponding value. That will be your short lived access_token to use with this script.
* [Create an S3 bucket](http://docs.aws.amazon.com/AmazonS3/latest/gsg/CreatingABucket.html).
* Ensure you have an appropriate AWS [access_key_id and secret_access_key](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html). Also make sure they are [stored properly](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html).

### Prerequisites

Create a python [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/), and use the requirements.txt file to install all the necessary components:

```
pip install -r requirements.txt
```

### Example Usage

To execute the script, you'll need to pass the appropriate token, number of previous runs to capture, S3 bucket, and filename to store the data in.

The following will grab the latest 3 runs from Nike+, gather GPS data for each of the runs, write the run information to a local file called *local_running.json*, then upload it to the S3 bucket *myS3Bucket* with a key of *running.json*.

```
./update.py --token iou23jk230sdfkj0a032kljasdf0 --runs 3 --bucket myS3Bucket --key running.json --file local_running.json
```

## Optional: Query with Amazon Athena

[Amazon Athena](https://aws.amazon.com/athena/) is an interactive, ad-hoc query service which makes it easy to query data stored in S3 using traditional ANSI SQL like syntax. With this data now stored in a single-line, JSON formatted syntax, you can now query it using Amazon Athena. See the [Getting Started](https://docs.aws.amazon.com/athena/latest/ug/getting-started.html) to get going with Amazon Athena.

First you'll need to create a table with the data:
```
CREATE EXTERNAL TABLE IF NOT EXISTS running (
    `status` string,
    `links` array<struct<href:string, rel:string>>,
    `tags` array<struct<tagValue:string, tagType:string>>,
    `metricSummary` struct<fuel:string, distance:string, duration:string, calories:string, steps:string>,
    `activityType` string,
    `state` string,
    `activityId` string,
    `deviceType` string,
    `gpsStart` struct<latitude:float, elevation:float, longitude:float>,
    `gpsEnd` struct<latitude:float, elevation:float, longitude:float>,
    `startTime` timestamp,
    `city` string,
    `activityTimeZone` string,
    `postal` string
)
ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES (
  'serialization.format' = '1'
) LOCATION 's3://myS3Bucket/path/to/file'
```
Be sure to replace the location of the S3 bucket and file with your appropriate path. Once that query succeeds, you can start to query your run data. Some example queries are below:

Average number of miles by terrain:
```
SELECT count(tag.tagValue) AS count,
         avg(cast(metricSummary.distance AS double)) AS average,
         tag.tagValue
FROM activity.running
CROSS JOIN unnest(tags) AS t(tag)
WHERE tag.tagType = 'TERRAIN'
GROUP BY  tag.tagValue
```

Total miles in 2014:
```
SELECT sum(cast(metricSummary.distance AS double))
FROM activity.running
WHERE starttime > varchar '2014-01-01' and starttime < varchar '2014-12-31';
```

Total miles by shoe:
```
SELECT count(tag.tagValue) AS runs,
         sum(cast(metricSummary.distance AS double)) AS miles,
         tag.tagValue AS shoes
FROM activity.running
CROSS JOIN unnest(tags) AS t(tag)
WHERE tag.tagType = 'SHOES'
GROUP BY  tag.tagValue
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details


text:
package io.kaif.mobile.kmark;

/**
 * This class represents a block of lines.
 *
 * @author René Jeschke <rene_jeschke@yahoo.de>
 */
class Block {

  /**
   * This block's type.
   */
  public BlockType type = BlockType.NONE;
  /**
   * Head and tail of linked lines.
   */
  public Line lines = null, lineTail = null;
  /**
   * Head and tail of child blocks.
   */
  public Block blocks = null, blockTail = null;
  /**
   * Next block.
   */
  public Block next = null;
  /**
   * ID for headlines and list items
   */
  public String id = null;
  /**
   * Block meta information
   */
  public String meta = "";

  /**
   * Constructor.
   */
  public Block() {
    //
  }

  /**
   * @return true if this block contains lines.
   */
  public boolean hasLines() {
    return this.lines != null;
  }

  /**
   * Removes leading and trailing empty lines.
   */
  public void removeSurroundingEmptyLines() {
    if (this.lines != null) {
      this.removeTrailingEmptyLines();
      this.removeLeadingEmptyLines();
    }
  }

  /**
   * Used for nested block quotes. Removes '>' char.
   */
  public void removeBlockQuotePrefix() {
    Line line = this.lines;
    while (line != null) {
      if (!line.isEmpty) {
        if (line.value.charAt(line.leading) == '>') {
          int rem = line.leading + 1;
          if (line.leading + 1 < line.value.length()
              && line.value.charAt(line.leading + 1) == ' ') {
            rem++;
          }
          line.value = line.value.substring(rem);
          line.initLeading();
        }
      }
      line = line.next;
    }
  }

  /**
   * Used for nested lists. Removes list markers and up to 4 leading spaces.
   */
  public void removeListIndent() {
    Line line = this.lines;
    while (line != null) {
      if (!line.isEmpty) {
        switch (line.getLineType()) {
          case ULIST:
            line.value = line.value.substring(line.leading + 2);
            break;
          case OLIST:
            line.value = line.value.substring(line.value.indexOf('.') + 2);
            break;
          default:
            line.value = line.value.substring(Math.min(line.leading, 4));
            break;
        }
        line.initLeading();
      }
      line = line.next;
    }
  }

  /**
   * Removes leading empty lines.
   *
   * @return true if an empty line was removed.
   */
  public boolean removeLeadingEmptyLines() {
    boolean wasEmpty = false;
    Line line = this.lines;
    while (line != null && line.isEmpty) {
      this.removeLine(line);
      line = this.lines;
      wasEmpty = true;
    }
    return wasEmpty;
  }

  /**
   * Removes trailing empty lines.
   */
  public void removeTrailingEmptyLines() {
    Line line = this.lineTail;
    while (line != null && line.isEmpty) {
      this.removeLine(line);
      line = this.lineTail;
    }
  }

  /**
   * Splits this block's lines, creating a new child block having 'line' as
   * it's lineTail.
   *
   * @param line
   *     The line to split from.
   * @return The newly created Block.
   */
  public Block split(final Line line) {
    final Block block = new Block();

    block.lines = this.lines;
    block.lineTail = line;
    this.lines = line.next;
    line.next = null;
    if (this.lines == null) {
      this.lineTail = null;
    } else {
      this.lines.previous = null;
    }

    if (this.blocks == null) {
      this.blocks = this.blockTail = block;
    } else {
      this.blockTail.next = block;
      this.blockTail = block;
    }

    return block;
  }

  /**
   * Removes the given line from this block.
   *
   * @param line
   *     Line to remove.
   */
  public void removeLine(final Line line) {
    if (line.previous == null) {
      this.lines = line.next;
    } else {
      line.previous.next = line.next;
    }
    if (line.next == null) {
      this.lineTail = line.previous;
    } else {
      line.next.previous = line.previous;
    }
    line.previous = line.next = null;
  }

  /**
   * Appends the given line to this block.
   *
   * @param line
   *     Line to append.
   */
  public void appendLine(final Line line) {
    if (this.lineTail == null) {
      this.lines = this.lineTail = line;
    } else {
      this.lineTail.nextEmpty = line.isEmpty;
      line.prevEmpty = this.lineTail.isEmpty;
      line.previous = this.lineTail;
      this.lineTail.next = line;
      this.lineTail = line;
    }
  }

  /**
   * Changes all Blocks of type NONE to PARAGRAPH if
   * this Block is a List and any of the ListItems contains a paragraph.
   */
  public void expandListParagraphs() {
    if (this.type != BlockType.ORDERED_LIST && this.type != BlockType.UNORDERED_LIST) {
      return;
    }
    Block outer = this.blocks, inner;
    boolean hasParagraph = false;
    while (outer != null && !hasParagraph) {
      if (outer.type == BlockType.ORDERED_LIST_ITEM
          || outer.type == BlockType.UNORDERED_LIST_ITEM) {
        inner = outer.blocks;
        while (inner != null && !hasParagraph) {
          if (inner.type == BlockType.PARAGRAPH) {
            hasParagraph = true;
          }
          inner = inner.next;
        }
      }
      outer = outer.next;
    }
    if (hasParagraph) {
      outer = this.blocks;
      while (outer != null) {
        if (outer.type == BlockType.ORDERED_LIST_ITEM
            || outer.type == BlockType.UNORDERED_LIST_ITEM) {
          inner = outer.blocks;
          while (inner != null) {
            if (inner.type == BlockType.NONE) {
              inner.type = BlockType.PARAGRAPH;
            }
            inner = inner.next;
          }
        }
        outer = outer.next;
      }
    }
  }
}


text:
id: 6450
title: Love in the time of Cholera (and other diseases)
date: 2012-02-14T07:44:53+00:00
author: Vicki
layout: post
guid: http://blog.vickiboykis.com/wlb/?p=6450
permalink: /2012/02/love-in-the-time-of-cholera-and-other-diseases/
categories:
  - Uncategorized
tags:
  - comic
---

  P.S. Here are my thoughts on VDay at The Forward.


text:
layout: default
---

Frequently Asked Questions (F.A.Q.)

What is Civic Tech?

What is Open Gov or Open Government?

What's a 'civic app'?

I'm not a techie. Can I still come?

That's ok! We encourage non-technical folks to pair up and learn from our community's designers and developers. Often times, the best civic projects come from teams with a diverse background.

Remember, there's a lot more to making a great app than just coding.


text:
<!doctype html>

  <meta charset="utf-8">
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">

  <link rel="stylesheet" href="/resources/demos/style.css">

Date: <input type="text" id="datepicker">


text:
using namespace nolang;

NamespaceDefParser::NamespaceDefParser(mpc_ast_t *t) :
    BaseParser(t)
{
}

void NamespaceDefParser::reset()
{
    cast = false;
    definitions.clear();
    res = new NamespaceDef();
}

void NamespaceDefParser::parseIdentifier()
{
    if (cast) res->setCast(item->contents);
    else definitions.push_back(item->contents);
}

void NamespaceDefParser::parseCast()
{
    cast = true;
}

void NamespaceDefParser::parseItem()
{
    if (isIdentifier()) parseIdentifier();
    else if (isCast()) parseCast();
    else if (isDot()); // TODO
    else if (isWhitespace());
    else printError("Unknown node in namespace defination", item);
}

void NamespaceDefParser::destroyResult()
{
    delete res;
    res = nullptr;
}

void NamespaceDefParser::setValues()
{
    if (!definitions.empty()) res->setValues(definitions);
    else destroyResult();
}

void NamespaceDefParser::postProcess()
{
    setValues();
}


text:
from __future__ import print_function

class Interval:
    def __init__(self, start, end):
        self.start = start
        self.end = end

    def print_interval(self):
        print("[" + str(self.start) + ", " + str(self.end) + "]", end='')

def merge(intervals_):
    intervals = sorted(intervals_, key=lambda x: x.start)
    merged = []
    pstart, pend = intervals[0].start, intervals[0].end
    for i in intervals:
        # overlap
        if i.start <= pend:
            pend = max(pend, i.end)
        else:
            merged.append(Interval(pstart, pend))
            pstart = i.start
            pend = i.end
    merged.append(Interval(pstart, pend))
    return merged

def main():
    print("Merged intervals: ", end='')
    for i in merge([Interval(1, 4), Interval(2, 5), Interval(7, 9)]):
        i.print_interval()
    print()

    print("Merged intervals: ", end='')
    for i in merge([Interval(6, 7), Interval(2, 4), Interval(5, 9)]):
        i.print_interval()
    print()

    print("Merged intervals: ", end='')
    for i in merge([Interval(1, 4), Interval(2, 6), Interval(3, 5)]):
        i.print_interval()
    print()

main()


text:
Sequel.migration do
    up do
        create_table(:attack_attempts) do
            primary_key :id
            DateTime :occured_at, :null => false
            String :request, :size => 1024, :null => false
            Integer :response, :null => false
            foreign_key :team_id, :teams, :index => true, :null => false
        end
    end

    down do
        drop_table(:attack_attempts)
    end
end


text:
<?php

class Stripe_CouponTest extends StripeTestCase
{
  public function testCreate()
  {
    authorizeFromEnv();
    $id = 'test_coupon-' . self::randomString();
    $c = Stripe_Coupon::create(
        array(
            'percent_off' => 25,
            'duration' => 'repeating',
            'duration_in_months' => 5,
            'id' => $id,
        )
    );
    $this->assertEqual($id, $c->id);
    // @codingStandardsIgnoreStart
    $this->assertEqual(25, $c->percent_off);
    // @codingStandardsIgnoreEnd
  }

}


text:
default['hbase']['hbase_site']['hbase.rootdir'] = "#{node['hadoop']['core_site']['fs.defaultFS']}/hbase"
# These are the defaults for hbase-policy.xml
default['hbase']['hbase_policy']['security.client.protocol.acl'] = '*'
default['hbase']['hbase_policy']['security.admin.protocol.acl'] = '*'
default['hbase']['hbase_policy']['security.masterregion.protocol.acl'] = '*'
# limits.d settings
default['hbase']['limits']['nofile'] = '32768'
default['hbase']['limits']['memlock'] = 'unlimited'


text:
storage_technology =
{
    type = "technology",
    name = "aerotech-storage",
    icon = "__AeroTechStorage__/graphics/aerotech-storage.png",
    effects = {},
    prerequisites = {"automation-2"},
    unit =
    {
        count = 200,
        ingredients =
        {
            {"science-pack-1", 1},
            {"science-pack-2", 1},
        },
        time = 10
    },
    order = "z",
}

for i,item in ipairs(packageable_items) do
    if data.raw.item[item] then
        storage_technology.effects[2*i-1] = {type = "unlock-recipe",recipe = "crate-"..item}
        storage_technology.effects[2*i] = {type = "unlock-recipe",recipe = "uncrate-"..item}
    end
end

data:extend({storage_technology})


text:
<?php

namespace PhpRQ;

/**
 * @author Jakub Chábek <jakub.chabek@heureka.cz>
 */
class UniqueQueueTest extends BaseTestCase
{

    public function testGetRedisClient()
    {
        $queue = new UniqueQueue($this->redis, 'test');
        $this->assertSame($this->redis, $queue->getRedisClient());
    }

    public function testGetQueueName()
    {
        $queueName = 'testQueueName-cz:xy';
        $queue = new UniqueQueue($this->redis, $queueName);
        $this->assertSame($queueName, $queue->getName());
    }

    public function testGetCount()
    {
        $this->redis->lpush('test', [1, 5, 3]);

        $queue = new UniqueQueue($this->redis, 'test');

        $this->assertSame(3, $queue->getCount());
        $this->assertKeys(['test']);
    }

    public function testAddItem()
    {
        $queue = new UniqueQueue($this->redis, 'test');
        $queue->addItem(1);
        $queue->addItem(3);
        $queue->addItem(5);
        $queue->addItem(3);

        $this->assertSame(['5', '3', '1'], $this->redis->lrange('test', 0, 5));

        $items = $this->redis->smembers('test-unique');
        $this->assertCount(3, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertKeys(['test', 'test-unique']);
    }

    /**
     * @dataProvider providerAddItemsEmpty
     */
    public function testAddItemEmpty($invalidItem = null)
    {
        $queue = new Queue($this->redis, 'test');
        $queue->addItem(1);

        try {
            $queue->addItem($invalidItem);
            $this->fail('Expected \PhpRQ\Exception\InvalidArgument to be thrown');
        } catch (Exception\InvalidArgument $e) {}

        $this->assertSame(['1'], $this->redis->lrange('test', 0, 5));
        $this->assertKeys(['test']);
    }

    public function testAddItems()
    {
        $queue = new UniqueQueue($this->redis, 'test');
        $queue->addItems([1, 3, 5]);
        $queue->addItems([3, 6]);

        $this->assertSame(['6', '5', '3', '1'], $this->redis->lrange('test', 0, 5));

        $items = $this->redis->smembers('test-unique');
        $this->assertCount(4, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertKeys(['test', 'test-unique']);
    }

    /**
     * @dataProvider providerAddItemsEmpty
     */
    public function testAddItemsEmpty($emptyItem = null)
    {
        $queue = new UniqueQueue($this->redis, 'test');

        try {
            $queue->addItems([1, $emptyItem, 5]);
            $this->fail('Expected \PhpRQ\Exception\InvalidArgument to be thrown');
        } catch (Exception\InvalidArgument $e) {}

        $this->assertKeys([]);
    }

    public function providerAddItemsEmpty()
    {
        return ['', null, 0, false];
    }

    public function testGetItems()
    {
        $this->redis->lpush('test', [1, 5, 3]);
        $this->redis->sadd('test-unique', [1, 5, 3]);

        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $items = $queue->getItems(2);
        $this->assertSame(['1', '5'], $items);

        $items = $queue->getItems(2);
        $this->assertSame(['3'], $items);

        $items = $queue->getItems(2);
        $this->assertSame([], $items);
        $this->assertKeys([
            sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK),
            'test-timeouts',
        ]);
    }

    /**
     * @dataProvider providerGetItemsInvalid
     */
    public function testGetItemsInvalid($count = null)
    {
        $queue = new UniqueQueue($this->redis, 'test');

        try {
            $queue->getItems($count);
            $this->fail('Expected \PhpRQ\Exception\InvalidArgument to be thrown');
        } catch (Exception\InvalidArgument $e) {}
    }

    public function providerGetItemsInvalid()
    {
        return [0, -5, '', null, false];
    }

    public function testGetAllItems()
    {
        $this->redis->lpush('test', [1, 5, 3]);
        $this->redis->sadd('test-unique', [1, 5, 3]);

        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $items = $queue->getAllItems();
        $this->assertSame(['1', '5', '3'], $items);

        $items = $queue->getAllItems();
        $this->assertSame([], $items);
        $this->assertKeys([
            sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK),
            'test-timeouts',
        ]);
    }

    public function testAckItem()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);
        $this->redis->lpush($processingQueue, [1, 5, 3]);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->ackItem(1);
        $queue->ackItem(3);
        $queue->ackItem(1);

        $this->assertSame(['5'], $this->redis->lrange($processingQueue, 0, 5));
        $this->assertSame([$processingQueue => (string)self::MICRO_TIME_MOCK], $this->redis->hgetall('test-timeouts'));
        $this->assertKeys([
            $processingQueue,
            'test-timeouts'
        ]);

        $queue->ackItem(5);

        $this->assertKeys([]);
    }

    public function testAckItems()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);
        $this->redis->lpush($processingQueue, [1, 5, 3, 6, 7]);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->ackItems([1, 3]);
        $queue->ackItems([1]);

        $this->assertSame(['7', '6', '5'], $this->redis->lrange($processingQueue, 0, 5));
        $this->assertSame([$processingQueue => (string)self::MICRO_TIME_MOCK], $this->redis->hgetall('test-timeouts'));
        $this->assertKeys([
            $processingQueue,
            'test-timeouts'
        ]);

        $queue->ackItems([5, 6]);
        $queue->ackItems([7]);

        $this->assertKeys([]);
    }

    public function testRejectItem()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);
        $this->redis->lpush($processingQueue, [1, 5, 3]);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->rejectItem(1);
        $queue->rejectItem(5);
        $queue->rejectItem(1);
        $queue->rejectItem(8);

        // order of the items is lost when using UniqueQueue:rejectItem, be aware of that
        $this->assertSame(['1', '5'], $this->redis->lrange('test', 0, 5));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(2, $items);
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('1', $items, true));
        $this->assertSame(['3'], $this->redis->lrange($processingQueue, 0, 5));
        $this->assertSame([$processingQueue => (string)self::MICRO_TIME_MOCK], $this->redis->hgetall('test-timeouts'));
        $this->assertKeys([
            'test',
            'test-unique',
            $processingQueue,
            'test-timeouts'
        ]);

        $queue->rejectItem(3);

        // order of the items is lost when using UniqueQueue:rejectItem, be aware of that
        $this->assertSame(['1', '5', '3'], $this->redis->lrange('test', 0, 5));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(3, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);

        $this->redis->lpush($processingQueue, 1);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->rejectItem(1);

        // order of the items is lost when using UniqueQueue:rejectItem, be aware of that
        $this->assertSame(['1', '5', '3'], $this->redis->lrange('test', 0, 5));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(3, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);
    }

    public function testRejectItems()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);
        $this->redis->lpush($processingQueue, [1, 5, 3, 6, 7]);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->rejectItems([1, 3]);
        $queue->rejectItems([1]);
        $queue->rejectItems([9, 12]);

        // order of the items is preserved with UniqueQueue:rejectItems only if there is a reject on all the remaining
        // items at once. Consecutive calls of this method causes the lost of the items order.
        $this->assertSame(['3', '1'], $this->redis->lrange('test', 0, 5));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(2, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertSame(['7', '6', '5'], $this->redis->lrange($processingQueue, 0, 5));
        $this->assertSame([$processingQueue => (string)self::MICRO_TIME_MOCK], $this->redis->hgetall('test-timeouts'));
        $this->assertKeys([
            'test',
            'test-unique',
            $processingQueue,
            'test-timeouts'
        ]);

        $queue->rejectItems([5, 6, 7]);

        // order of the items is preserved with UniqueQueue:rejectItems only if there is a reject on all the remaining
        // items at once. Consecutive calls of this method causes the lost of the items order.
        $this->assertSame(['3', '1', '7', '6', '5'], $this->redis->lrange('test', 0, 10));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(5, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertTrue(in_array('7', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);

        $this->redis->lpush($processingQueue, 1);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->rejectItems([1]);

        // order of the items is preserved with UniqueQueue:rejectItems only if there is a reject on all the remaining
        // items at once. Consecutive calls of this method causes the lost of the items order.
        $this->assertSame(['3', '1', '7', '6', '5'], $this->redis->lrange('test', 0, 10));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(5, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertTrue(in_array('7', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);
    }

    public function testRejectBatch()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);
        $this->redis->lpush($processingQueue, [1, 5, 3, 6, 7]);
        $this->redis->hset('test-timeouts', $processingQueue, self::MICRO_TIME_MOCK);

        $queue->ackItem(3);
        $queue->rejectBatch();

        $this->assertSame(['7', '6', '5', '1'], $this->redis->lrange('test', 0, 10));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(4, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertTrue(in_array('7', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);
    }

    public function testReEnqueueTimedOutItems()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue1 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 15);
        $this->redis->lpush($processingQueue1, [1, 5, 3]);
        $this->redis->hset('test-timeouts', $processingQueue1, self::MICRO_TIME_MOCK - 15);

        $processingQueue2 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 10);
        $this->redis->lpush($processingQueue2, [1, 4, 6]);
        $this->redis->hset('test-timeouts', $processingQueue2, self::MICRO_TIME_MOCK - 10);

        $processingQueue3 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 5);
        $this->redis->lpush($processingQueue3, [4, 7, 8]);
        $this->redis->hset('test-timeouts', $processingQueue3, self::MICRO_TIME_MOCK - 5);

        $queue->reEnqueueTimedOutItems(7);

        $this->assertSame(['6', '4', '3', '5', '1'], $this->redis->lrange('test', 0, 10));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(5, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('4', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertSame(['8', '7', '4'], $this->redis->lrange($processingQueue3, 0, 5));
        $this->assertSame(
            [$processingQueue3 => (string)(self::MICRO_TIME_MOCK - 5)],
            $this->redis->hgetall('test-timeouts')
        );
        $this->assertKeys([
            'test',
            'test-unique',
            'test-timeouts',
            $processingQueue3,
        ]);

        $queue->reEnqueueTimedOutItems(0);

        $this->assertSame(['6', '3', '5', '1', '8', '7', '4'], $this->redis->lrange('test', 0, 10));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(7, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('4', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertTrue(in_array('7', $items, true));
        $this->assertTrue(in_array('8', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);
    }

    public function testReEnqueueAllItems()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue1 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 15);
        $this->redis->lpush($processingQueue1, [1, 5, 3]);
        $this->redis->hset('test-timeouts', $processingQueue1, self::MICRO_TIME_MOCK - 15);

        $processingQueue2 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 10);
        $this->redis->lpush($processingQueue2, [1, 4, 6]);
        $this->redis->hset('test-timeouts', $processingQueue2, self::MICRO_TIME_MOCK - 10);

        $processingQueue3 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 5);
        $this->redis->lpush($processingQueue3, [4, 7, 8]);
        $this->redis->hset('test-timeouts', $processingQueue3, self::MICRO_TIME_MOCK - 5);

        $queue->reEnqueueAllItems();

        $this->assertSame(['8', '7', '6', '4', '3', '5', '1'], $this->redis->lrange('test', 0, 10));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(7, $items);
        $this->assertTrue(in_array('1', $items, true));
        $this->assertTrue(in_array('3', $items, true));
        $this->assertTrue(in_array('4', $items, true));
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertTrue(in_array('7', $items, true));
        $this->assertTrue(in_array('8', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);
    }

    public function testDropTimedOutItems()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue1 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 15);
        $this->redis->lpush($processingQueue1, [1, 5, 3]);
        $this->redis->hset('test-timeouts', $processingQueue1, self::MICRO_TIME_MOCK - 15);

        $processingQueue2 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 10);
        $this->redis->lpush($processingQueue2, [1, 4, 6]);
        $this->redis->hset('test-timeouts', $processingQueue2, self::MICRO_TIME_MOCK - 10);

        $processingQueue3 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 5);
        $this->redis->lpush($processingQueue3, [4, 7, 8]);
        $this->redis->hset('test-timeouts', $processingQueue3, self::MICRO_TIME_MOCK - 5);

        $queue->dropTimedOutItems(7);

        $this->assertSame([], $this->redis->lrange('test', 0, 5));
        $this->assertSame([], $this->redis->smembers('test-unique'));
        $this->assertSame(['8', '7', '4'], $this->redis->lrange($processingQueue3, 0, 5));
        $this->assertSame(
            [$processingQueue3 => (string)(self::MICRO_TIME_MOCK - 5)],
            $this->redis->hgetall('test-timeouts')
        );
        $this->assertKeys([
            'test-timeouts',
            $processingQueue3,
        ]);

        $queue->dropTimedOutItems(0);

        $this->assertKeys([]);
    }

    public function testDropAllItems()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());

        $processingQueue1 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 15);
        $this->redis->lpush($processingQueue1, [1, 5, 3]);
        $this->redis->hset('test-timeouts', $processingQueue1, self::MICRO_TIME_MOCK - 15);

        $processingQueue2 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 10);
        $this->redis->lpush($processingQueue2, [1, 4, 6]);
        $this->redis->hset('test-timeouts', $processingQueue2, self::MICRO_TIME_MOCK - 10);

        $processingQueue3 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 5);
        $this->redis->lpush($processingQueue3, [4, 7, 8]);
        $this->redis->hset('test-timeouts', $processingQueue3, self::MICRO_TIME_MOCK - 5);

        $queue->dropAllItems();

        $this->assertKeys([]);
    }

    public function testClearQueue()
    {
        $queue = new UniqueQueue($this->redis, 'test', [
            UniqueQueue::OPT_DEL_MAX_CHUNK_SIZE => 2
        ], $this->getTimeMock());

        $this->redis->lpush('test', [1, 5, 3]);
        $this->redis->sadd('test-unique', [1, 5, 3]);

        $processingQueue1 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 15);
        $this->redis->lpush($processingQueue1, [1, 8, 4]);
        $this->redis->hset('test-timeouts', $processingQueue1, self::MICRO_TIME_MOCK - 15);

        $processingQueue2 = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK - 10);
        $this->redis->lpush($processingQueue2, [2, 6, 7]);
        $this->redis->hset('test-timeouts', $processingQueue2, self::MICRO_TIME_MOCK - 10);

        $queue->clearQueue();

        $this->assertKeys([]);
    }

    public function testRealUseCaseExample1()
    {
        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());
        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);

        $queue->addItems([1, 2, 3, 1, 5, 6, 7]);
        $items = $queue->getItems(5);

        $this->assertSame(['1', '2', '3', '5', '6'], $items);
        $this->assertSame(['7'], $this->redis->lrange('test', 0, 5));
        $this->assertSame(['7'], $this->redis->smembers('test-unique'));
        $this->assertSame(['6', '5', '3', '2', '1'], $this->redis->lrange($processingQueue, 0, 10));
        $this->assertKeys([
            'test',
            'test-unique',
            $processingQueue,
            'test-timeouts',
        ]);

        $queue->ackItem(1);
        $queue->ackItems([2, 3]);
        $queue->rejectBatch();

        $this->assertSame(['7', '6', '5'], $this->redis->lrange('test', 0, 5));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(3, $items);
        $this->assertTrue(in_array('5', $items, true));
        $this->assertTrue(in_array('6', $items, true));
        $this->assertTrue(in_array('7', $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);

        $items = $queue->getItems(5);

        $this->assertSame(['5', '6', '7'], $items);
        $this->assertSame(['7', '6', '5'], $this->redis->lrange($processingQueue, 0, 5));
        $this->assertKeys([
            $processingQueue,
            'test-timeouts',
        ]);

        $queue->ackItems([5, 6, 7]);

        $this->assertKeys([]);
    }

    public function testRealUseCaseExample2()
    {
        $message1 = new ExampleMessageObject();
        $message1->int = 1;
        $message1->float = 1.1;
        $message1->string = 'something1';
        $message1->bool = true;
        $message1Serialized = serialize($message1);

        $message2 = new ExampleMessageObject();
        $message2->int = 3;
        $message2->float = 3.3;
        $message2->string = 'something2';
        $message2->bool = false;
        $message2Serialized = serialize($message2);

        $message3 = new ExampleMessageObject();
        $message3->int = 4;
        $message3->float = 4.4;
        $message3->string = 'something3';
        $message3->bool = true;
        $message3Serialized = serialize($message3);

        $message4 = new ExampleMessageObject();
        $message4->int = 5;
        $message4->float = 5.5;
        $message4->string = 'something4';
        $message4->bool = false;
        $message4Serialized = serialize($message4);

        $message5 = new ExampleMessageObject();
        $message5->int = 6;
        $message5->float = 6.6;
        $message5->string = 'something5';
        $message5->bool = true;
        $message5Serialized = serialize($message5);

        $queue = new UniqueQueue($this->redis, 'test', [], $this->getTimeMock());
        $processingQueue = sprintf('test-processing-%s[%d][%d]', gethostname(), getmypid(), self::TIME_MOCK);

        $queue->addItems([$message1, $message2, $message3, $message1, $message4, $message5]);
        $items = $queue->getItems(4);

        $this->assertSame([$message1Serialized, $message2Serialized, $message3Serialized, $message4Serialized], $items);
        $this->assertSame([$message5Serialized], $this->redis->lrange('test', 0, 5));
        $this->assertSame([$message5Serialized], $this->redis->smembers('test-unique'));
        $this->assertSame(
            [$message4Serialized, $message3Serialized, $message2Serialized, $message1Serialized],
            $this->redis->lrange($processingQueue, 0, 10)
        );
        $this->assertKeys([
            'test',
            'test-unique',
            $processingQueue,
            'test-timeouts',
        ]);

        $queue->ackItem($message1);
        $queue->ackItems([$message2, $message3]);
        $queue->rejectBatch();

        $this->assertSame([$message5Serialized, $message4Serialized], $this->redis->lrange('test', 0, 5));
        $items = $this->redis->smembers('test-unique');
        $this->assertCount(2, $items);
        $this->assertTrue(in_array($message4Serialized, $items, true));
        $this->assertTrue(in_array($message5Serialized, $items, true));
        $this->assertKeys([
            'test',
            'test-unique',
        ]);

        $items = $queue->getItems(5);

        $this->assertSame([$message4Serialized, $message5Serialized], $items);
        $this->assertSame([$message5Serialized, $message4Serialized], $this->redis->lrange($processingQueue, 0, 5));
        $this->assertKeys([
            $processingQueue,
            'test-timeouts',
        ]);

        $queue->ackItems([$message4Serialized, $message5Serialized]);

        $this->assertKeys([]);
    }

}


text:
require "heroku/command/base"

module Heroku::Command

  # DEPRECATED: see `heroku certs` instead
  #
  # manage ssl certificates for an app
  #
  class Ssl < Base

    # ssl
    #
    # list legacy certificates for an app
    #
    def index
      api.get_domains(app).body.each do |domain|
        if cert = domain['cert']
          display "#{domain['domain']} has a SSL certificate registered to #{cert['subject']} which expires on #{format_date(cert['expires_at'])}"
        else
          display "#{domain['domain']} has no certificate"
        end
      end
    end

    # ssl:add PEM KEY
    #
    # DEPRECATED: see `heroku certs:add` instead
    #
    def add
      $stderr.puts " !    `heroku ssl:add` has been deprecated. Please use the SSL Endpoint add-on and the `heroku certs` commands instead."
      $stderr.puts " !    SSL Endpoint documentation is available at: https://devcenter.heroku.com/articles/ssl-endpoint"
    end

    # ssl:clear
    #
    # remove legacy ssl certificates from an app
    #
    def clear
      heroku.clear_ssl(app)
      display "Cleared certificates for #{app}"
    end
  end
end


text:
<?php

$states = array("Delaware","Pennsylvania","New Jersey");
arsort($states);
print_r($states);

?>


text:
@implementation CursorFolderView

#pragma mark Object creation and destruction

- (void)dealloc
{
    self.nameLabel = nil;

    [super dealloc];
}

#pragma mark Accessors and mutators

@synthesize nameLabel = m_nameLabel;

@end


text:
@implementation SocialNetworkBase

- (void) login {

    NSLog(@"Login with username: %@ and Password: %@ On Network: %@", self.userName, self.userPassword, self.socialNetworkName);
    [self loginTheUser];
}

- (void) logout {

    NSLog(@"Logout from user: %@", self.userName);
}

- (void) loginTheUser {

    NSLog(@"Authenticating...");
    NSLog(@"Responding...");
    NSLog(@"Login Successful.");
}

@end


text:
package org.elasticsearch.repositories.azure;

public class AzureServiceDisableException extends IllegalStateException {
    public AzureServiceDisableException(String msg) {
        super(msg);
    }

    public AzureServiceDisableException(String msg, Throwable cause) {
        super(msg, cause);
    }
}


text:
using UnityEngine;
using System.Collections;

public class ChooseCharacter : MonoBehaviour {
	public bool Syphen=false;
	public bool Blitz=false;

	// Use this for initialization
	void Start () {
		GlobalVariables.syphen = this.Syphen;
		GlobalVariables.blitz = this.Blitz;
	}

}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#include "pal_types.h"
#include "pal_compiler.h"
#include "opensslshim.h"

/*
NID values that are used in managed code.
*/
typedef enum
{
    PAL_NID_undef = 0,
    PAL_NID_X9_62_prime256v1 = 415,
    PAL_NID_secp224r1 = 713,
    PAL_NID_secp384r1 = 715,
    PAL_NID_secp521r1 = 716,
} SupportedAlgorithmNids;

/*
Direct shim to OBJ_txt2obj.
*/
DLLEXPORT const ASN1_OBJECT* CryptoNative_ObjTxt2Obj(const char* s);

/*
Direct shim to OBJ_obj2txt.
*/
DLLEXPORT int32_t CryptoNative_ObjObj2Txt(char* buf, int32_t buf_len, const ASN1_OBJECT* a);

/*
Retrieves the ASN1_OBJECT for the specified friendly name.

Can return nullptr if there isn't a corresponding shared object.
*/
DLLEXPORT const ASN1_OBJECT* CryptoNative_GetObjectDefinitionByName(const char* friendlyName);

/*
Direct shim to OBJ_sn2nid.
*/
DLLEXPORT int32_t CryptoNative_ObjSn2Nid(const char* sn);

/*
Direct shim to OBJ_txt2nid.
*/
DLLEXPORT int32_t CryptoNative_ObjTxt2Nid(const char* sn);

/*
Direct shim to OBJ_nid2obj.
*/
DLLEXPORT const ASN1_OBJECT* CryptoNative_ObjNid2Obj(int32_t nid);

/*
Direct shim to ASN1_OBJECT_free.
*/
DLLEXPORT void CryptoNative_Asn1ObjectFree(ASN1_OBJECT* a);

/*
Shims the d2i_ASN1_BIT_STRING method and makes it easier to invoke from managed code.
*/
DLLEXPORT ASN1_BIT_STRING* CryptoNative_DecodeAsn1BitString(const uint8_t* buf, int32_t len);

/*
Direct shim to ASN1_BIT_STRING_free.
*/
DLLEXPORT void CryptoNative_Asn1BitStringFree(ASN1_STRING* a);

/*
Shims the d2i_ASN1_OCTET_STRING method and makes it easier to invoke from managed code.
*/
DLLEXPORT ASN1_OCTET_STRING* CryptoNative_DecodeAsn1OctetString(const uint8_t* buf, int32_t len);

/*
Direct shim to ASN1_OCTET_STRING_new.
*/
DLLEXPORT ASN1_OCTET_STRING* CryptoNative_Asn1OctetStringNew(void);

/*
Direct shim to ASN1_OCTET_STRING_set.
*/
DLLEXPORT int32_t CryptoNative_Asn1OctetStringSet(ASN1_OCTET_STRING* s, const uint8_t* data, int32_t len);

/*
Direct shim to ASN1_OCTET_STRING_free.
*/
DLLEXPORT void CryptoNative_Asn1OctetStringFree(ASN1_STRING* a);

/*
Direct shim to ASN1_STRING_free.
*/
DLLEXPORT void CryptoNative_Asn1StringFree(ASN1_STRING* a);

/*
Returns the number of bytes it will take to convert
the ASN1_INTEGER to a DER format.
*/
DLLEXPORT int32_t CryptoNative_GetAsn1IntegerDerSize(ASN1_INTEGER* i);

/*
Shims the i2d_ASN1_INTEGER method.

Returns the number of bytes written to buf.
*/
DLLEXPORT int32_t CryptoNative_EncodeAsn1Integer(ASN1_INTEGER* i, uint8_t* buf);


text:
=========
MiniBench
=========

.. image:: https://secure.travis-ci.org/noirbizarre/minibench.png
    :target: http://travis-ci.org/noirbizarre/minibench
    :alt: Build status
.. image:: https://coveralls.io/repos/noirbizarre/minibench/badge.png?branch=master
    :target: https://coveralls.io/r/noirbizarre/minibench?branch=master
    :alt: Code coverage
.. image:: https://requires.io/github/noirbizarre/minibench/requirements.png?branch=master
    :target: https://requires.io/github/noirbizarre/minibench/requirements/?branch=master
    :alt: Requirements Status
.. image:: https://readthedocs.org/projects/minibench/badge/?version=latest
    :target: http://minibench.readthedocs.org/en/latest/
    :alt: Documentation status

MiniBench provides a simple framework for benchmarking following the ``unittest`` module pattern.

Compatibility
=============

minibench requires Python 2.7+.

Installation
============

You can install minibench with pip:

.. code-block:: console

    $ pip install minibench

or with easy_install:

.. code-block:: console

    $ easy_install minibench

Quick start
===========

Write your benchmarks as you would write you unittests.
Just create a ``.bench.py`` file.

.. code-block:: python

    # fake.bench.py
    from minibench import Benchmark

    class FakeBenchmark(Benchmark):
        '''Fake benchmark'''
        def bench_fake(self):
            '''Run my bench'''
            # Do something

Then run it with the ``bench`` command

.. code-block:: console

    $ bench
    >>> Fake benchmark (x5)
    Run my bench ......................................... ✔ (0.1234s)

Documentation
=============

The documentation is hosted `on Read the Docs <http://minibench.readthedocs.org/en/latest/>`_


text:
package com.ppm.integration.agilesdk.connector.jira.model;

import org.json.JSONObject;

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

public class IssueRetrievalResult {

    private List<JSONObject> issues = new ArrayList<>();

    private int startAt;

    private int maxResults;

    private int total;

    public IssueRetrievalResult(int startAt, int maxResults, int total) {
        this.startAt = startAt;
        this.maxResults = maxResults;
        this.total = total;
    }

    public List<JSONObject> getIssues() {
        return issues;
    }

    public void addIssue(JSONObject issue) {
        issues.add(issue);
    }

    public int getStartAt() {
        return startAt;
    }

    public int getMaxResults() {
        return maxResults;
    }

    public int getTotal() {
        return total;
    }
}