text:
/* Define EVENT_Driven to raise event when data is received.
 * but can use a little more CPU time.
 */
#define EVENT_DRIVEN

using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace CRTerm.IO
{
  class SerialIO
  {
    private string _PortName = "COM4";
    private System.IO.Ports.SerialPort port;
    //public RingBuffer recData = new RingBuffer();
    volatile private bool ThreadDone = false;
#if EVENT_DRIVEN
#else
    private Thread ReadThread;
#endif

    byte[] recData = new byte[256];
    //int pos;
    int MessageLength;

    /// <summary>
    /// The serial port used to communicate with the PCR
    /// </summary>
    public string PortName
    {
      get { return _PortName; }
      set { _PortName = value; }
    }

    public bool Opened
    {
      get
      {
        if (port != null)
          return port.IsOpen;
        else
          return false;
      }
    }

    public void Open()
    {
      port = new System.IO.Ports.SerialPort(_PortName);
      port.BaudRate = 9600;
      port.Parity = System.IO.Ports.Parity.None;
      port.DataBits = 8;
      port.StopBits = System.IO.Ports.StopBits.One;

      try
      {
        port.Open();
#if EVENT_DRIVEN
        port.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(port_DataReceived);
#else
        ReadThread = new Thread(ReadThreadMain);
        ReadThread.Start();
#endif
      }
      catch (Exception ex)
      {
        // if the port can't be opened, allow the program to run
        // but with no data communication. However, the main form should handle this
        throw new CRTException("COM Port not available: " + PortName + "\n" +
          "Edit the Application config file to set the correct COM port\n" +
          ex.Message);
      }
    }

    internal void Close()
    {
      ThreadDone = true;
#if ! EVENT_DRIVEN
      ReadThread.Join();
#endif
      port.DataReceived -= port_DataReceived;
      port.Close();
    }

    public void ReadThreadMain()
    {
      while (ThreadDone == false)
      {
        while (DataWaiting() && ThreadDone == false)
          port_DataReceived(null, null);
        System.Threading.Thread.Sleep(100);
      }
    }

    void port_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
    {
      //readBuffer();
      //if (ResponseValid())
      //{
      //  PCREventArgs response = new PCREventArgs();
      //  response.Data = recData;
      //  response.responseNumber = (ResponseNumberEnum)response.Data[0];
      //  if (onResponseReceived != null)
      //    onResponseReceived(response);
      //}
    }

    /// <summary>
    /// Get the expected length of the response in the buffer, including the 2 byte header
    /// and the 2 byte footer.
    /// </summary>
    /// <returns>Expected length of the response message.</returns>
    int ResponseLength()
    {
      int length = recData[2] * 256 + recData[3];
      return length + 6;
    }

    /// <summary>
    /// Check to see if the response in the buffer is complete.
    /// This looks at the length of the response and compares it to the length
    /// bytes in the response (offset 2-3, zero base). If the length is correct
    /// then return True. If the length is not, return false
    /// </summary>
    /// <returns>True if the buffer contains a valid command.</returns>
    bool ResponseValid()
    {
      return MessageLength > 0;
    }

    /// <summary>
    /// Check to see whether there's data ready to process.
    /// </summary>
    /// <returns></returns>
    bool DataWaiting()
    {
      if (port != null && (port.BytesToRead > 6))
        return true;
      else
        return false;
    }

    virtual public void SendCommand(byte[] data)
    {
      if (port.IsOpen) {
        byte[] buffer;
        int length = data.Length + 6;
        buffer = new byte[length];
        buffer[0] = 0x5a;
        buffer[1] = 0xa5;
        buffer[2] = (byte)(data.Length / 256);
        buffer[3] = (byte)(data.Length & 0x00ff);
        System.Array.Copy(data, 0, buffer, 4, data.Length);
        buffer[length - 2] = 0xed;
        buffer[length - 1] = 0xed;
        port.Write(buffer, 0, buffer.Length);
      }
    }

    void readBuffer()
    {
      int x;
      MessageLength=0;
      //pos=0;
      if(port.BytesToRead > 6)
      {
        x = 0;
        while(x != 0x5a)
          x=port.ReadByte();
        x = port.ReadByte();
        if (x != 0xa5)
          return;

        MessageLength = port.ReadByte() * 256 + port.ReadByte();
        while (port.BytesToRead < MessageLength + 2)
          System.Threading.Thread.Sleep(1);
        port.Read(recData, 0, MessageLength+2);
      }
    }

  }
}


text:
module ChatAdapter; end

require_relative './chat-adapter/logging'
require_relative './chat-adapter/base'
require_relative './chat-adapter/shell'
require_relative './chat-adapter/irc'
require_relative './chat-adapter/slack'
require_relative './chat-adapter/hipchat'

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Constant Field Values (library 1.0.0 API)</title>
<meta name="date" content="2017-01-04">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Constant Field Values

Contents

io.upnext.*

io.upnext.*

io.upnext.beaconcontrol.sdk.Beacon

Modifier and Type
Constant Field
Value

public static final double
DISTANCE_UNDEFINED
1.7976931348623157E308

io.upnext.beaconcontrol.sdk.BeaconControl.ActionReceiver

Modifier and Type
Constant Field
Value

public static final java.lang.String
ACTION_END
"BeaconControl.ActionReceiver.ACTION_END"

public static final java.lang.String
ACTION_START
"BeaconControl.ActionReceiver.ACTION_START"

public static final java.lang.String
PROCESS_RESPONSE
"BeaconControl.ActionReceiver.PROCESS_RESPONSE"

io.upnext.beaconcontrol.sdk.BeaconControl.BeaconProximityChangeReceiver

Modifier and Type
Constant Field
Value

public static final java.lang.String
BEACON
"BeaconControl.BeaconProximityChangeReceiver.BEACON"

public static final java.lang.String
PROCESS_RESPONSE
"BeaconControl.BeaconProximityChangeReceiver.PROCESS_RESPONSE"

io.upnext.beaconcontrol.sdk.BeaconControl.ConfigurationLoadReceiver

Modifier and Type
Constant Field
Value

public static final java.lang.String
BEACONS_LIST
"BeaconControl.ConfigurationLoadReceiver.BEACONS_LIST"

public static final java.lang.String
PROCESS_RESPONSE
"BeaconControl.ConfigurationLoadReceiver.PROCESS_RESPONSE"

Skip navigation links

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--><html><head>
      <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
          <title>paper-input tests</title>
            <script src="/components/web-component-tester/browser.js"></script>
</head>
<body>
    <script>
    WCT.loadSuites([ // eslint-disable-line no-undef
            'modules_collection.html?wc-shadydom=true&wc-ce=true',
            'modules_convert.html?wc-shadydom=true&wc-ce=true',
            'modules_core.html?wc-shadydom=true&wc-ce=true',
            'modules_iterables.html?wc-shadydom=true&wc-ce=true',
            'modules_collection.html?dom=shadow',
            'modules_convert.html?dom=shadow',
            'modules_core.html?dom=shadow',
            'modules_iterables.html?dom=shadow',
          ]);
  </script>
</body></html>


text:
'use strict';

exports.up = function(knex, Promise) {
  return knex.schema.table('user', function(table) {
    table.dropColumn('role');
  });
};

exports.down = function(knex, Promise) {
  return knex.schema.table('user', function(table) {
    table.integer('role');
  });
};


text:
define('lodash-amd/modern/internals/baseIndexOf',[], function() {

  /**
   * The base implementation of `_.indexOf` without support for binary searches
   * or `fromIndex` constraints.
   *
   * @private
   * @param {Array} array The array to search.
   * @param {*} value The value to search for.
   * @param {number} [fromIndex=0] The index to search from.
   * @returns {number} Returns the index of the matched value or `-1`.
   */
  function baseIndexOf(array, value, fromIndex) {
    var index = (fromIndex || 0) - 1,
        length = array ? array.length : 0;

    while (++index < length) {
      if (array[index] === value) {
        return index;
      }
    }
    return -1;
  }

  return baseIndexOf;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/isNative',[], function() {

  /** Used for native method references */
  var objectProto = Object.prototype;

  /** Used to resolve the internal [[Class]] of values */
  var toString = objectProto.toString;

  /** Used to detect if a method is native */
  var reNative = RegExp('^' +
    String(toString)
      .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
      .replace(/toString| for [^\]]+/g, '.*?') + '$'
  );

  /**
   * Checks if `value` is a native function.
   *
   * @private
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if the `value` is a native function, else `false`.
   */
  function isNative(value) {
    return typeof value == 'function' && reNative.test(value);
  }

  return isNative;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/objectTypes',[], function() {

  /** Used to determine if values are of the language type Object */
  var objectTypes = {
    'boolean': false,
    'function': true,
    'object': true,
    'number': false,
    'string': false,
    'undefined': false
  };

  return objectTypes;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/isObject',['../internals/objectTypes'], function(objectTypes) {

  /**
   * Checks if `value` is the language type of Object.
   * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if the `value` is an object, else `false`.
   * @example
   *
   * _.isObject({});
   * // => true
   *
   * _.isObject([1, 2, 3]);
   * // => true
   *
   * _.isObject(1);
   * // => false
   */
  function isObject(value) {
    // check if the value is the ECMAScript language type of Object
    // http://es5.github.io/#x8
    // and avoid a V8 bug
    // http://code.google.com/p/v8/issues/detail?id=2291
    return !!(value && objectTypes[typeof value]);
  }

  return isObject;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/utilities/noop',[], function() {

  /**
   * A no-operation function.
   *
   * @static
   * @memberOf _
   * @category Utilities
   * @example
   *
   * var object = { 'name': 'fred' };
   * _.noop(object) === undefined;
   * // => true
   */
  function noop() {
    // no operation performed
  }

  return noop;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/baseCreate',['./isNative', '../objects/isObject', '../utilities/noop'], function(isNative, isObject, noop) {

  /* Native method shortcuts for methods with the same name as other `lodash` methods */
  var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate;

  /**
   * The base implementation of `_.create` without support for assigning
   * properties to the created object.
   *
   * @private
   * @param {Object} prototype The object to inherit from.
   * @returns {Object} Returns the new object.
   */
  function baseCreate(prototype, properties) {
    return isObject(prototype) ? nativeCreate(prototype) : {};
  }
  // fallback for browsers without `Object.create`
  if (!nativeCreate) {
    baseCreate = (function() {
      function Object() {}
      return function(prototype) {
        if (isObject(prototype)) {
          Object.prototype = prototype;
          var result = new Object;
          Object.prototype = null;
        }
        return result || window.Object();
      };
    }());
  }

  return baseCreate;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/setBindData',['./isNative', '../utilities/noop'], function(isNative, noop) {

  /** Used as the property descriptor for `__bindData__` */
  var descriptor = {
    'configurable': false,
    'enumerable': false,
    'value': null,
    'writable': false
  };

  /** Used to set meta data on functions */
  var defineProperty = (function() {
    // IE 8 only accepts DOM elements
    try {
      var o = {},
          func = isNative(func = Object.defineProperty) && func,
          result = func(o, o, o) && func;
    } catch(e) { }
    return result;
  }());

  /**
   * Sets `this` binding data on a given function.
   *
   * @private
   * @param {Function} func The function to set data on.
   * @param {Array} value The data array to set.
   */
  var setBindData = !defineProperty ? noop : function(func, value) {
    descriptor.value = value;
    defineProperty(func, '__bindData__', descriptor);
  };

  return setBindData;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/slice',[], function() {

  /**
   * Slices the `collection` from the `start` index up to, but not including,
   * the `end` index.
   *
   * Note: This function is used instead of `Array#slice` to support node lists
   * in IE < 9 and to ensure dense arrays are returned.
   *
   * @private
   * @param {Array|Object|string} collection The collection to slice.
   * @param {number} start The start index.
   * @param {number} end The end index.
   * @returns {Array} Returns the new array.
   */
  function slice(array, start, end) {
    start || (start = 0);
    if (typeof end == 'undefined') {
      end = array ? array.length : 0;
    }
    var index = -1,
        length = end - start || 0,
        result = Array(length < 0 ? 0 : length);

    while (++index < length) {
      result[index] = array[start + index];
    }
    return result;
  }

  return slice;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/baseBind',['./baseCreate', '../objects/isObject', './setBindData', './slice'], function(baseCreate, isObject, setBindData, slice) {

  /**
   * Used for `Array` method references.
   *
   * Normally `Array.prototype` would suffice, however, using an array literal
   * avoids issues in Narwhal.
   */
  var arrayRef = [];

  /** Native method shortcuts */
  var push = arrayRef.push;

  /**
   * The base implementation of `_.bind` that creates the bound function and
   * sets its meta data.
   *
   * @private
   * @param {Array} bindData The bind data array.
   * @returns {Function} Returns the new bound function.
   */
  function baseBind(bindData) {
    var func = bindData[0],
        partialArgs = bindData[2],
        thisArg = bindData[4];

    function bound() {
      // `Function#bind` spec
      // http://es5.github.io/#x15.3.4.5
      if (partialArgs) {
        // avoid `arguments` object deoptimizations by using `slice` instead
        // of `Array.prototype.slice.call` and not assigning `arguments` to a
        // variable as a ternary expression
        var args = slice(partialArgs);
        push.apply(args, arguments);
      }
      // mimic the constructor's `return` behavior
      // http://es5.github.io/#x13.2.2
      if (this instanceof bound) {
        // ensure `new bound` is an instance of `func`
        var thisBinding = baseCreate(func.prototype),
            result = func.apply(thisBinding, args || arguments);
        return isObject(result) ? result : thisBinding;
      }
      return func.apply(thisArg, args || arguments);
    }
    setBindData(bound, bindData);
    return bound;
  }

  return baseBind;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/baseCreateWrapper',['./baseCreate', '../objects/isObject', './setBindData', './slice'], function(baseCreate, isObject, setBindData, slice) {

  /**
   * Used for `Array` method references.
   *
   * Normally `Array.prototype` would suffice, however, using an array literal
   * avoids issues in Narwhal.
   */
  var arrayRef = [];

  /** Native method shortcuts */
  var push = arrayRef.push;

  /**
   * The base implementation of `createWrapper` that creates the wrapper and
   * sets its meta data.
   *
   * @private
   * @param {Array} bindData The bind data array.
   * @returns {Function} Returns the new function.
   */
  function baseCreateWrapper(bindData) {
    var func = bindData[0],
        bitmask = bindData[1],
        partialArgs = bindData[2],
        partialRightArgs = bindData[3],
        thisArg = bindData[4],
        arity = bindData[5];

    var isBind = bitmask & 1,
        isBindKey = bitmask & 2,
        isCurry = bitmask & 4,
        isCurryBound = bitmask & 8,
        key = func;

    function bound() {
      var thisBinding = isBind ? thisArg : this;
      if (partialArgs) {
        var args = slice(partialArgs);
        push.apply(args, arguments);
      }
      if (partialRightArgs || isCurry) {
        args || (args = slice(arguments));
        if (partialRightArgs) {
          push.apply(args, partialRightArgs);
        }
        if (isCurry && args.length < arity) {
          bitmask |= 16 & ~32;
          return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]);
        }
      }
      args || (args = arguments);
      if (isBindKey) {
        func = thisBinding[key];
      }
      if (this instanceof bound) {
        thisBinding = baseCreate(func.prototype);
        var result = func.apply(thisBinding, args);
        return isObject(result) ? result : thisBinding;
      }
      return func.apply(thisBinding, args);
    }
    setBindData(bound, bindData);
    return bound;
  }

  return baseCreateWrapper;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/isFunction',[], function() {

  /**
   * Checks if `value` is a function.
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if the `value` is a function, else `false`.
   * @example
   *
   * _.isFunction(_);
   * // => true
   */
  function isFunction(value) {
    return typeof value == 'function';
  }

  return isFunction;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/createWrapper',['./baseBind', './baseCreateWrapper', '../objects/isFunction', './slice'], function(baseBind, baseCreateWrapper, isFunction, slice) {

  /**
   * Used for `Array` method references.
   *
   * Normally `Array.prototype` would suffice, however, using an array literal
   * avoids issues in Narwhal.
   */
  var arrayRef = [];

  /** Native method shortcuts */
  var push = arrayRef.push,
      unshift = arrayRef.unshift;

  /**
   * Creates a function that, when called, either curries or invokes `func`
   * with an optional `this` binding and partially applied arguments.
   *
   * @private
   * @param {Function|string} func The function or method name to reference.
   * @param {number} bitmask The bitmask of method flags to compose.
   *  The bitmask may be composed of the following flags:
   *  1 - `_.bind`
   *  2 - `_.bindKey`
   *  4 - `_.curry`
   *  8 - `_.curry` (bound)
   *  16 - `_.partial`
   *  32 - `_.partialRight`
   * @param {Array} [partialArgs] An array of arguments to prepend to those
   *  provided to the new function.
   * @param {Array} [partialRightArgs] An array of arguments to append to those
   *  provided to the new function.
   * @param {*} [thisArg] The `this` binding of `func`.
   * @param {number} [arity] The arity of `func`.
   * @returns {Function} Returns the new function.
   */
  function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) {
    var isBind = bitmask & 1,
        isBindKey = bitmask & 2,
        isCurry = bitmask & 4,
        isCurryBound = bitmask & 8,
        isPartial = bitmask & 16,
        isPartialRight = bitmask & 32;

    if (!isBindKey && !isFunction(func)) {
      throw new TypeError;
    }
    if (isPartial && !partialArgs.length) {
      bitmask &= ~16;
      isPartial = partialArgs = false;
    }
    if (isPartialRight && !partialRightArgs.length) {
      bitmask &= ~32;
      isPartialRight = partialRightArgs = false;
    }
    var bindData = func && func.__bindData__;
    if (bindData && bindData !== true) {
      // clone `bindData`
      bindData = slice(bindData);
      if (bindData[2]) {
        bindData[2] = slice(bindData[2]);
      }
      if (bindData[3]) {
        bindData[3] = slice(bindData[3]);
      }
      // set `thisBinding` is not previously bound
      if (isBind && !(bindData[1] & 1)) {
        bindData[4] = thisArg;
      }
      // set if previously bound but not currently (subsequent curried functions)
      if (!isBind && bindData[1] & 1) {
        bitmask |= 8;
      }
      // set curried arity if not yet set
      if (isCurry && !(bindData[1] & 4)) {
        bindData[5] = arity;
      }
      // append partial left arguments
      if (isPartial) {
        push.apply(bindData[2] || (bindData[2] = []), partialArgs);
      }
      // append partial right arguments
      if (isPartialRight) {
        unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs);
      }
      // merge flags
      bindData[1] |= bitmask;
      return createWrapper.apply(null, bindData);
    }
    // fast path for `_.bind`
    var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper;
    return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]);
  }

  return createWrapper;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/functions/bind',['../internals/createWrapper', '../internals/slice'], function(createWrapper, slice) {

  /**
   * Creates a function that, when called, invokes `func` with the `this`
   * binding of `thisArg` and prepends any additional `bind` arguments to those
   * provided to the bound function.
   *
   * @static
   * @memberOf _
   * @category Functions
   * @param {Function} func The function to bind.
   * @param {*} [thisArg] The `this` binding of `func`.
   * @param {...*} [arg] Arguments to be partially applied.
   * @returns {Function} Returns the new bound function.
   * @example
   *
   * var func = function(greeting) {
   *   return greeting + ' ' + this.name;
   * };
   *
   * func = _.bind(func, { 'name': 'fred' }, 'hi');
   * func();
   * // => 'hi fred'
   */
  function bind(func, thisArg) {
    return arguments.length > 2
      ? createWrapper(func, 17, slice(arguments, 2), null, thisArg)
      : createWrapper(func, 1, null, null, thisArg);
  }

  return bind;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/utilities/identity',[], function() {

  /**
   * This method returns the first argument provided to it.
   *
   * @static
   * @memberOf _
   * @category Utilities
   * @param {*} value Any value.
   * @returns {*} Returns `value`.
   * @example
   *
   * var object = { 'name': 'fred' };
   * _.identity(object) === object;
   * // => true
   */
  function identity(value) {
    return value;
  }

  return identity;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/support',['./internals/isNative'], function(isNative) {

  /** Used to detect functions containing a `this` reference */
  var reThis = /\bthis\b/;

  /**
   * An object used to flag environments features.
   *
   * @static
   * @memberOf _
   * @type Object
   */
  var support = {};

  /**
   * Detect if functions can be decompiled by `Function#toString`
   * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps).
   *
   * @memberOf _.support
   * @type boolean
   */
  support.funcDecomp = !isNative(window.WinRTError) && reThis.test(function() { return this; });

  /**
   * Detect if `Function#name` is supported (all but IE).
   *
   * @memberOf _.support
   * @type boolean
   */
  support.funcNames = typeof Function.name == 'string';

  return support;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/baseCreateCallback',['../functions/bind', '../utilities/identity', './setBindData', '../support'], function(bind, identity, setBindData, support) {

  /** Used to detected named functions */
  var reFuncName = /^\s*function[ \n\r\t]+\w/;

  /** Used to detect functions containing a `this` reference */
  var reThis = /\bthis\b/;

  /** Native method shortcuts */
  var fnToString = Function.prototype.toString;

  /**
   * The base implementation of `_.createCallback` without support for creating
   * "_.pluck" or "_.where" style callbacks.
   *
   * @private
   * @param {*} [func=identity] The value to convert to a callback.
   * @param {*} [thisArg] The `this` binding of the created callback.
   * @param {number} [argCount] The number of arguments the callback accepts.
   * @returns {Function} Returns a callback function.
   */
  function baseCreateCallback(func, thisArg, argCount) {
    if (typeof func != 'function') {
      return identity;
    }
    // exit early for no `thisArg` or already bound by `Function#bind`
    if (typeof thisArg == 'undefined' || !('prototype' in func)) {
      return func;
    }
    var bindData = func.__bindData__;
    if (typeof bindData == 'undefined') {
      if (support.funcNames) {
        bindData = !func.name;
      }
      bindData = bindData || !support.funcDecomp;
      if (!bindData) {
        var source = fnToString.call(func);
        if (!support.funcNames) {
          bindData = !reFuncName.test(source);
        }
        if (!bindData) {
          // checks if `func` references the `this` keyword and stores the result
          bindData = reThis.test(source);
          setBindData(func, bindData);
        }
      }
    }
    // exit early if there are no `this` references or `func` is bound
    if (bindData === false || (bindData !== true && bindData[1] & 1)) {
      return func;
    }
    switch (argCount) {
      case 1: return function(value) {
        return func.call(thisArg, value);
      };
      case 2: return function(a, b) {
        return func.call(thisArg, a, b);
      };
      case 3: return function(value, index, collection) {
        return func.call(thisArg, value, index, collection);
      };
      case 4: return function(accumulator, value, index, collection) {
        return func.call(thisArg, accumulator, value, index, collection);
      };
    }
    return bind(func, thisArg);
  }

  return baseCreateCallback;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/internals/shimKeys',['./objectTypes'], function(objectTypes) {

  /** Used for native method references */
  var objectProto = Object.prototype;

  /** Native method shortcuts */
  var hasOwnProperty = objectProto.hasOwnProperty;

  /**
   * A fallback implementation of `Object.keys` which produces an array of the
   * given object's own enumerable property names.
   *
   * @private
   * @type Function
   * @param {Object} object The object to inspect.
   * @returns {Array} Returns an array of property names.
   */
  var shimKeys = function(object) {
    var index, iterable = object, result = [];
    if (!iterable) return result;
    if (!(objectTypes[typeof object])) return result;
      for (index in iterable) {
        if (hasOwnProperty.call(iterable, index)) {
          result.push(index);
        }
      }
    return result
  };

  return shimKeys;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/keys',['../internals/isNative', './isObject', '../internals/shimKeys'], function(isNative, isObject, shimKeys) {

  /* Native method shortcuts for methods with the same name as other `lodash` methods */
  var nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys;

  /**
   * Creates an array composed of the own enumerable property names of an object.
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {Object} object The object to inspect.
   * @returns {Array} Returns an array of property names.
   * @example
   *
   * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
   * // => ['one', 'two', 'three'] (property order is not guaranteed across environments)
   */
  var keys = !nativeKeys ? shimKeys : function(object) {
    if (!isObject(object)) {
      return [];
    }
    return nativeKeys(object);
  };

  return keys;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/forOwn',['../internals/baseCreateCallback', './keys', '../internals/objectTypes'], function(baseCreateCallback, keys, objectTypes) {

  /**
   * Iterates over own enumerable properties of an object, executing the callback
   * for each property. The callback is bound to `thisArg` and invoked with three
   * arguments; (value, key, object). Callbacks may exit iteration early by
   * explicitly returning `false`.
   *
   * @static
   * @memberOf _
   * @type Function
   * @category Objects
   * @param {Object} object The object to iterate over.
   * @param {Function} [callback=identity] The function called per iteration.
   * @param {*} [thisArg] The `this` binding of `callback`.
   * @returns {Object} Returns `object`.
   * @example
   *
   * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
   *   console.log(key);
   * });
   * // => logs '0', '1', and 'length' (property order is not guaranteed across environments)
   */
  var forOwn = function(collection, callback, thisArg) {
    var index, iterable = collection, result = iterable;
    if (!iterable) return result;
    if (!objectTypes[typeof iterable]) return result;
    callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
      var ownIndex = -1,
          ownProps = objectTypes[typeof iterable] && keys(iterable),
          length = ownProps ? ownProps.length : 0;

      while (++ownIndex < length) {
        index = ownProps[ownIndex];
        if (callback(iterable[index], index, collection) === false) return result;
      }
    return result
  };

  return forOwn;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/isArray',['../internals/isNative'], function(isNative) {

  /** `Object#toString` result shortcuts */
  var arrayClass = '[object Array]';

  /** Used for native method references */
  var objectProto = Object.prototype;

  /** Used to resolve the internal [[Class]] of values */
  var toString = objectProto.toString;

  /* Native method shortcuts for methods with the same name as other `lodash` methods */
  var nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray;

  /**
   * Checks if `value` is an array.
   *
   * @static
   * @memberOf _
   * @type Function
   * @category Objects
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if the `value` is an array, else `false`.
   * @example
   *
   * (function() { return _.isArray(arguments); })();
   * // => false
   *
   * _.isArray([1, 2, 3]);
   * // => true
   */
  var isArray = nativeIsArray || function(value) {
    return value && typeof value == 'object' && typeof value.length == 'number' &&
      toString.call(value) == arrayClass || false;
  };

  return isArray;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/isString',[], function() {

  /** `Object#toString` result shortcuts */
  var stringClass = '[object String]';

  /** Used for native method references */
  var objectProto = Object.prototype;

  /** Used to resolve the internal [[Class]] of values */
  var toString = objectProto.toString;

  /**
   * Checks if `value` is a string.
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {*} value The value to check.
   * @returns {boolean} Returns `true` if the `value` is a string, else `false`.
   * @example
   *
   * _.isString('fred');
   * // => true
   */
  function isString(value) {
    return typeof value == 'string' ||
      value && typeof value == 'object' && toString.call(value) == stringClass || false;
  }

  return isString;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/collections/contains',['../internals/baseIndexOf', '../objects/forOwn', '../objects/isArray', '../objects/isString'], function(baseIndexOf, forOwn, isArray, isString) {

  /* Native method shortcuts for methods with the same name as other `lodash` methods */
  var nativeMax = Math.max;

  /**
   * Checks if a given value is present in a collection using strict equality
   * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the
   * offset from the end of the collection.
   *
   * @static
   * @memberOf _
   * @alias include
   * @category Collections
   * @param {Array|Object|string} collection The collection to iterate over.
   * @param {*} target The value to check for.
   * @param {number} [fromIndex=0] The index to search from.
   * @returns {boolean} Returns `true` if the `target` element is found, else `false`.
   * @example
   *
   * _.contains([1, 2, 3], 1);
   * // => true
   *
   * _.contains([1, 2, 3], 1, 2);
   * // => false
   *
   * _.contains({ 'name': 'fred', 'age': 40 }, 'fred');
   * // => true
   *
   * _.contains('pebbles', 'eb');
   * // => true
   */
  function contains(collection, target, fromIndex) {
    var index = -1,
        indexOf = baseIndexOf,
        length = collection ? collection.length : 0,
        result = false;

    fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
    if (isArray(collection)) {
      result = indexOf(collection, target, fromIndex) > -1;
    } else if (typeof length == 'number') {
      result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1;
    } else {
      forOwn(collection, function(value) {
        if (++index >= fromIndex) {
          return !(result = value === target);
        }
      });
    }
    return result;
  }

  return contains;
});

define('scribe-common/src/element',['lodash-amd/modern/collections/contains'], function (contains) {

  // TODO: not exhaustive?
  var blockElementNames = ['P', 'LI', 'DIV', 'BLOCKQUOTE', 'UL', 'OL', 'H1',
                           'H2', 'H3', 'H4', 'H5', 'H6', 'TABLE', 'TH', 'TD'];
  function isBlockElement(node) {
    return contains(blockElementNames, node.nodeName);
  }

  function isSelectionMarkerNode(node) {
    return (node.nodeType === Node.ELEMENT_NODE && node.className === 'scribe-marker');
  }

  function isCaretPositionNode(node) {
    return (node.nodeType === Node.ELEMENT_NODE && node.className === 'caret-position');
  }

  function unwrap(node, childNode) {
    while (childNode.childNodes.length > 0) {
      node.insertBefore(childNode.childNodes[0], childNode);
    }
    node.removeChild(childNode);
  }

  return {
    isBlockElement: isBlockElement,
    isSelectionMarkerNode: isSelectionMarkerNode,
    isCaretPositionNode: isCaretPositionNode,
    unwrap: unwrap
  };

});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/objects/values',['./keys'], function(keys) {

  /**
   * Creates an array composed of the own enumerable property values of `object`.
   *
   * @static
   * @memberOf _
   * @category Objects
   * @param {Object} object The object to inspect.
   * @returns {Array} Returns an array of property values.
   * @example
   *
   * _.values({ 'one': 1, 'two': 2, 'three': 3 });
   * // => [1, 2, 3] (property order is not guaranteed across environments)
   */
  function values(object) {
    var index = -1,
        props = keys(object),
        length = props.length,
        result = Array(length);

    while (++index < length) {
      result[index] = object[props[index]];
    }
    return result;
  }

  return values;
});

/**
 * Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
 * Build: `lodash modularize modern exports="amd" -o ./modern/`
 * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
 * Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 * Available under MIT license <http://lodash.com/license>
 */
define('lodash-amd/modern/collections/toArray',['../objects/isString', '../internals/slice', '../objects/values'], function(isString, slice, values) {

  /**
   * Converts the `collection` to an array.
   *
   * @static
   * @memberOf _
   * @category Collections
   * @param {Array|Object|string} collection The collection to convert.
   * @returns {Array} Returns the new converted array.
   * @example
   *
   * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
   * // => [2, 3, 4]
   */
  function toArray(collection) {
    if (collection && typeof collection.length == 'number') {
      return slice(collection);
    }
    return values(collection);
  }

  return toArray;
});

define('scribe-plugin-curly-quotes',[
  'scribe-common/src/element',
  'lodash-amd/modern/collections/toArray'
], function (
  elementHelpers,
  toArray
) {

  return function () {

    var openDoubleCurly = '"';
    var closeDoubleCurly = '"';

    var openSingleCurly = ''';
    var closeSingleCurly = ''';

    var NON_BREAKING_SPACE = '\u00A0';

    return function (scribe) {
      /**
       * Run the formatter as you type on the current paragraph.
       *
       * FIXME: We wouldn't have to do this if the formatters were run on text
       * node mutations, but that's expensive unil we have a virtual DOM.
       */

      var keys = {
        34: '"',
        39: '\''
      };
      var curlyQuoteChar;

      // `input` doesn't tell us what key was pressed, so we grab it beforehand
      scribe.el.addEventListener('keypress', function (event) {
        curlyQuoteChar = keys[event.charCode];
      });

      // When the character is actually inserted, format it to transform.
      scribe.el.addEventListener('input', function () {
        if (curlyQuoteChar) {
          var selection = new scribe.api.Selection();
          var containingBlockElement = scribe.allowsBlockElements()
            ? selection.getContaining(elementHelpers.isBlockElement)
            : scribe.el;

          selection.placeMarkers();
          containingBlockElement.innerHTML = substituteCurlyQuotes(containingBlockElement.innerHTML);
          selection.selectMarkers();
          // Reset
          curlyQuoteChar = undefined;
        }
      });

      // Substitute quotes on setting content or paste
      scribe.registerHTMLFormatter('normalize', substituteCurlyQuotes);

      function isWordCharacter(character) {
          return /[^\s()]/.test(character);
      }

      function substituteCurlyQuotes(html) {
        // We don't want to replace quotes within the HTML markup
        // (e.g. attributes), only to text nodes
        var holder = document.createElement('div');
        holder.innerHTML = html;

        // Replace straight single and double quotes with curly
        // equivalent in the given string
        mapElements(holder, function(prev, str) {
          // Tokenise HTML elements vs text between them
          // Note: this is escaped HTML in the text node!
          // Split by elements
          // We tokenise with the previous text nodes for context, but
          // only extract the current text node.
          var tokens = (prev + str).split(/(<[^>]+?>(?:.*<\/[^>]+?>)?)/);
          return tokens
            .map(function(token) {
              // Only replace quotes in text between (potential) HTML elements
              if (/^</.test(token)) {
                return token;
              } else {
                return convert(token);
              }
            })
            .join('')
            .slice(prev.length);
        });

        return holder.innerHTML;
      }

      // Recursively convert the quotes to curly quotes. We have to do this
      // recursively instead of with a global match because the latter would
      // not detect overlaps, e.g. "'1'" (text can only be matched once).
      function convert(str) {
        if (! /['"]/.test(str)) {
          return str;
        } else {
          var foo = str.
            // Use [\s\S] instead of . to match any characters _including newlines_
            replace(/([\s\S])?'/,
                    replaceQuotesFromContext(openSingleCurly, closeSingleCurly)).
            replace(/([\s\S])?"/,
                    replaceQuotesFromContext(openDoubleCurly, closeDoubleCurly));
          return convert(foo);
        }
      }

      function replaceQuotesFromContext(openCurly, closeCurly) {
        return function(m, prev) {
          prev = prev || '';
          var hasCharsBefore = isWordCharacter(prev);
          // Optimistic heuristic, would need to look at DOM structure
          // (esp block vs inline elements) for more robust inference
          if (hasCharsBefore) {
            return prev + closeCurly;
          } else {
            return prev + openCurly;
          }
        };
      }

      // Apply a function on all text nodes in a container, mutating in place
      function mapElements(containerElement, func) {
        // TODO: This heuristic breaks for elements that contain a mixture of
        // inline and block elements.
        var nestedBlockElements = toArray(containerElement.children).filter(elementHelpers.isBlockElement);
        if (nestedBlockElements.length) {
          nestedBlockElements.forEach(function (nestedBlockElement) {
            // Map the nested block elements
            mapElements(nestedBlockElement, func);
          });
        } else {
          mapTextNodes(containerElement, func);
        }
      }

      function mapTextNodes(containerElement, func) {
        // TODO: Only walk inside of text nodes within inline elements
        var walker = document.createTreeWalker(containerElement, NodeFilter.SHOW_TEXT);
        var node = walker.firstChild();
        var prevTextNodes = '';
        while (node) {
          // Split by BR
          if (node.previousSibling && node.previousSibling.nodeName === 'BR') {
            prevTextNodes = '';
          }
          node.data = func(prevTextNodes, node.data);
          prevTextNodes += node.data;
          node = walker.nextSibling();
        }
      }

    };
  };

});

//# sourceMappingURL=scribe-plugin-curly-quotes.js.map


text:
class KeywordSet
  include ActiveRecord::Validations
  attr_accessor :keywords

  validate :all_keywords_ok

  def all_keywords_ok
    keywords.each {|k| keywords.add(k.error) unless k.valid?}
  end

  def save
    keywords.all?(&:save)
  end

  def keywords=(incoming_data)
    @keywords = []
    incoming_data.split("\r\n").each do |k|
      @keywords << Keyword.new(:word => k) unless Keyword.where(word: k).count > 0
    end
  end

  def keywords
    @keywords
  end
end


text:
import test from 'ava';
import { stub } from 'sinon';
import getPullRequestLabel from '../../../lib/getPullRequestLabel';
import defaultValidLabels from '../../../lib/validLabels';

function createGithubClient(labels = []) {
    return {
        issues: {
            listLabelsOnIssue: stub().resolves({ data: labels })
        }
    };
}

const anyRepo = 'any/repo';
const anyPullRequestId = 123;

test('requests the labels for the correct repo and pull request', async (t) => {
    const githubClient = createGithubClient([{ name: 'bug' }]);

    await getPullRequestLabel(anyRepo, defaultValidLabels, anyPullRequestId, { githubClient });

    t.is(githubClient.issues.listLabelsOnIssue.callCount, 1);
    t.deepEqual(githubClient.issues.listLabelsOnIssue.firstCall.args, [
        { owner: 'any', repo: 'repo', issue_number: 123 }
    ]);
});

test('fulfills with the correct label name', async (t) => {
    const githubClient = createGithubClient([{ name: 'bug' }]);

    const expectedLabelName = 'bug';

    t.is(await getPullRequestLabel(anyRepo, defaultValidLabels, anyPullRequestId, { githubClient }), expectedLabelName);
});

test('uses custom labels when provided', async (t) => {
    const githubClient = createGithubClient([{ name: 'addons' }]);

    const expectedLabelName = 'addons';
    const customValidLabels = new Map([['addons', 'Addons']]);

    t.is(await getPullRequestLabel(anyRepo, customValidLabels, anyPullRequestId, { githubClient }), expectedLabelName);
});

test('rejects if the pull request doesn't have one valid label', async (t) => {
    const githubClient = createGithubClient([]);

    const expectedErrorMessage =
        'Pull Request #123 has no label of breaking, bug, feature, enhancement, documentation, upgrade, refactor, build';

    await t.throwsAsync(getPullRequestLabel(anyRepo, defaultValidLabels, anyPullRequestId, { githubClient }), {
        message: expectedErrorMessage
    });
});

test('rejects if the pull request has more than one valid label', async (t) => {
    const githubClient = createGithubClient([{ name: 'bug' }, { name: 'documentation' }]);
    const expectedErrorMessage =
        'Pull Request #123 has multiple labels of breaking, bug, feature, enhancement, documentation, upgrade, refactor, build';

    await t.throwsAsync(getPullRequestLabel(anyRepo, defaultValidLabels, anyPullRequestId, { githubClient }), {
        message: expectedErrorMessage
    });
});


text:
using namespace fm;

Listener::Listener() {
	alListener3f(AL_POSITION, 0, 0, 1.0f);
	alListener3f(AL_VELOCITY, 0, 0, 0);
	alListenerfv(AL_ORIENTATION, listenerOri);
}

void Listener::setPosition(math::Vector2f pos) {
	alListener3f(AL_POSITION, pos.x, pos.y, 1.0f);
}

Listener::~Listener() {}


text:
helpers do

  # I am lazy and don't like typing env['omniauth.auth'] all the time.
  # So I made an auth_hash helper
  def auth_hash
    env['omniauth.auth']
  end

  def current_user
    @current_user ||= User.find(session[:user_id])
  end

  def logged_in?
    !session[:user_id].nil?
  end

  def logout!
    session[:user_id] = nil
  end

  def starred_message(gossyp)
    gossyp.starred_by?(current_user) ? "starred" : "unstarred"
  end

  def star_button_text(gossyp)
    gossyp.starred_by?(current_user) ? "Unstar" : "Star"
  end
end


text:
'use strict';

var fs = require('fs');
var _loader = require('./js-yaml/loader');

var jsyaml = module.exports = {};

jsyaml.scan = function scan(stream, callback, Loader) {
  Loader = (Loader || _loader.SafeLoader);

  var loader = new Loader(stream);
  while (loader.checkToken()) {
    callback(loader.getToken());
  }
};

jsyaml.compose = function compose(stream, Loader) {
  Loader = (Loader || _loader.SafeLoader);

  var loader = new Loader(stream);
  return loader.getSingleNode();
};

jsyaml.load = function load(stream, Loader) {
  Loader = (Loader || _loader.Loader);

  var loader = new Loader(stream);
  return loader.getSingleData();
};

jsyaml.loadAll = function loadAll(stream, callback, Loader) {
  Loader = (Loader || _loader.Loader);

  var loader = new Loader(stream);
  while (loader.checkData()) {
    callback(loader.getData());
  }
};

jsyaml.safeLoad = function load(stream) {
  return jsyaml.load(stream, _loader.SafeLoader);
};

jsyaml.safeLoadAll = function loadAll(stream, callback) {
  jsyaml.loadAll(stream, callback, _loader.SafeLoader);
};

/**
 *  jsyaml.addConstructor(tag, constructor[, Loader]) -> Void
 *  Add a constructor for the given tag.
 *
 *  Constructor is a function that accepts a Loader instance
 *  and a node object and produces the corresponding JavaScript object.
 **/
jsyaml.addConstructor = function addConstructor(tag, constructor, Loader) {
  (Loader || _loader.Loader).addConstructor(tag, constructor);
};

// Register extensions handler
(function () {
  var require_handler = function (module, filename) {
    var fd = fs.openSync(filename, 'r');

    // fill in documents
    module.exports = [];
    jsyaml.loadAll(fd, function (doc) { module.exports.push(doc); });

    fs.closeSync(fd);
  };

  // register require extensions only if we're on node.js
  // hack for browserify
  if (undefined !== require.extensions) {
    require.extensions['.yml'] = require_handler;
    require.extensions['.yaml'] = require_handler;
  }
}());

////////////////////////////////////////////////////////////////////////////////
// vim:ts=2:sw=2
////////////////////////////////////////////////////////////////////////////////


text:
@interface GViewController : UITableViewController

@end


text:
所有学生

        创建学生

        <input type="search" class="form-control" style="width: 250px"  placeholder="搜索" ng-model="filterOptions.filterText"/>

                <button type="button" class="close" data-dismiss="modal">×关闭</button>

创建学生

                <form name="studentForm" class="form-group">
                    <input type="text" class="form-control" placeholder="*新学生姓名" ng-model="newStudent.name" required>

                    <input type="text" class="form-control" placeholder="*新学生用户名" ng-model="newStudent.username" required>

                    <select class="form-control"  ng-model="newStudent.school" ng-options="school.name for school in schools" required>
                        <option style="display:none" value="">请选择学校</option>
                    </select>
                </form>

                <button class="btn btn-defautl" data-dismiss="modal">取消</button>
                <button class="btn btn-success" ng-click="createStudent(studentForm.$valid)" ng-disabled="studentForm.$invalid">确定</button>

                <button type="button" class="close" data-dismiss="modal">×关闭</button>

批量创建学生

                <form name="studentBatchForm">

每行一个学生,请按照如下格式输入:

  姓名1,用户名1      或      姓名1    用户名1

  姓名2,用户名2                  姓名2   用户名2

                    <textarea ng-model="newStudentsList" style="height: 100px" class="form-control" required></textarea>

提示:分隔符可以使用半角逗号、全角逗号和空格。

                </form>

                <button class="btn btn-defautl" data-dismiss="modal">取消</button>
                <button class="btn btn-success" ng-click="createStudentBatch(studentBatchForm.$valid)" ng-disabled="studentBatchForm.$invalid">确定</button>

                <button type="button" class="close" data-dismiss="modal">×关闭</button>

编辑学生

                <form name="editForm" class="form-group">

                           姓名
                        <input type="text" id="newName" class="form-control" style="width:400px" placeholder="新姓名" ng-model="temp.newName" required>

                        用户名
                        <input type="text" id="newUsername" class="form-control" style="width:400px" placeholder="新用户名" ng-model="temp.newUsername" required>

                           学校
                        <select class="form-control" id="newSchool" style="width:400px" ng-model="temp.newSchool" ng-options="school.name for school in schools" required>

                        </select>

                </form>
                修改失败,可能由于用户名已存在。请修改用户名后重试。

                <button class="btn btn-defautl" data-dismiss="modal">取消</button>
                <button class="btn btn-success btn-lg" ng-click="editStudent(row)" ng-disabled="editForm.$invalid">确定</button>


text:
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>misc</title>
<link rel="stylesheet" type="text/css" href="../stpr.css">

misc

  adaboost.m

  adaclass.m

  cerror.m

  crossval.m

  knnclass.m

  knnrule.m

  roc.m

  weaklearner.m


text:
namespace arrow {

[[noreturn]] void Unreachable(const char* message) {
  DCHECK(false) << message;
  std::abort();
}

}  // namespace arrow


text:
@interface PZTagTableViewCell ()

@property (weak, nonatomic) IBOutlet UIView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *labTitle;

@end

@implementation PZTagTableViewCell
{
    __weak PZTagItem *_dataItem;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

    if (self)
    {
    }

    return self;
}

- (void)awakeFromNib
{
    [super awakeFromNib];

    self.iconView.layer.backgroundColor = [UIColor redColor].CGColor;
    self.iconView.layer.cornerRadius = 3;
}

- (PZTagItem *)dataItem
{
    return self->_dataItem;
}

- (void)setDataItem:(PZTagItem *)dataItem
{
    self->_dataItem = dataItem;

    self.hasLeftSwipeAction = NO;

    self.labTitle.text = dataItem.name;

    self.iconView.backgroundColor = dataItem.color;
}

@end


text:
{% assign some_bool = true %}

## Plugin Includes
include from plugin → {% include test-plugin:some-include.html %}
Yo Dawg, I heard you like includes. → {% include test-plugin:greet.html greeting="Yo Dawg" %}
'' → '{% include test-plugin:greet.html greeting="Yo Dawg" unless some_bool %}'
Yo Dawg, I heard you like includes. → {% include test-plugin:greet.html greeting="Yo Dawg" if some_bool %}

## Override plugin include
Overrides plugin include → {% include test-plugin:bar.html %}

## Plugin config access
{% include test-plugin:config.html %}


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

  <color name="blue">#0096ff</color>
  <color name="black">#000000</color>
  <color name="grey">#1e1e1e</color>
  <color name="blue_dark">#0099cc</color>
  <color name="green">#99cc00</color>
  <color name="green_dark">#669900</color>
  <color name="red">#ff4444</color>
  <color name="red_dark">#cc0000</color>
  <color name="yellow">#ffbb33</color>
  <color name="orange">#ff8800</color>
  <color name="violet_light">#aa66cc</color>
  <color name="violet">#9933cc</color>
  <color name="grey_light">#eeeeee</color>
  <color name="grey_mid">#aaaaaa</color>
  <color name="white">#ffffff</color>
  <color name="none">#11ffffff</color>

  <!-- The default background of the menu. -->
  <color name="md__defaultBackground">#FF555555</color>

</resources>


text:
package physics

type Point struct {
	X float64
	Y float64
}

type Velocity struct {
	Direction float64
	Speed     float64
}


text:
<?php

echo '<pre>';
var_dump($_SERVER);

require 'libs/PDOFactory.php';
require 'libs/ProdutoModel.php';
require 'libs/ProdutoModelFactory.php';

$produtoModel = ProdutoModelFactory::create();
$produto = $produtoModel->getById($_GET['id']);

if ($produto === false) {
  die('Produto não encontrado!');
}

require 'templates/visualizar-produto.phtml';

?>


text:
namespace Microsoft.Azure.Management.Logz
{
    using Microsoft.Rest;
    using Microsoft.Rest.Azure;
    using Models;
    using System.Collections;
    using System.Collections.Generic;
    using System.Threading;
    using System.Threading.Tasks;

    /// <summary>
    /// MonitorsOperations operations.
    /// </summary>
    public partial interface IMonitorsOperations
    {
        /// <summary>
        /// List the resources currently being monitored by the Logz monitor
        /// resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<MonitoredResource>>> ListMonitoredResourcesWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List all monitors under the specified subscription.
        /// </summary>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<LogzMonitorResource>>> ListBySubscriptionWithHttpMessagesAsync(Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List all monitors under the specified resource group.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<LogzMonitorResource>>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Get the properties of a specific monitor resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<LogzMonitorResource>> GetWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Create a monitor resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='body'>
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<LogzMonitorResource>> CreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, LogzMonitorResource body = default(LogzMonitorResource), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Update a monitor resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='body'>
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<LogzMonitorResource>> UpdateWithHttpMessagesAsync(string resourceGroupName, string monitorName, LogzMonitorResourceUpdateParameters body = default(LogzMonitorResourceUpdateParameters), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Delete a monitor resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<MonitorsDeleteHeaders>> DeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Create a monitor resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='body'>
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<LogzMonitorResource>> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string monitorName, LogzMonitorResource body = default(LogzMonitorResource), Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// Delete a monitor resource.
        /// </summary>
        /// <param name='resourceGroupName'>
        /// The name of the resource group. The name is case insensitive.
        /// </param>
        /// <param name='monitorName'>
        /// Monitor resource name
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationHeaderResponse<MonitorsDeleteHeaders>> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string monitorName, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List the resources currently being monitored by the Logz monitor
        /// resource.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<MonitoredResource>>> ListMonitoredResourcesNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List all monitors under the specified subscription.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<LogzMonitorResource>>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
        /// <summary>
        /// List all monitors under the specified resource group.
        /// </summary>
        /// <param name='nextPageLink'>
        /// The NextLink from the previous successful call to List operation.
        /// </param>
        /// <param name='customHeaders'>
        /// The headers that will be added to request.
        /// </param>
        /// <param name='cancellationToken'>
        /// The cancellation token.
        /// </param>
        /// <exception cref="ErrorResponseException">
        /// Thrown when the operation returned an invalid status code
        /// </exception>
        /// <exception cref="Microsoft.Rest.SerializationException">
        /// Thrown when unable to deserialize the response
        /// </exception>
        /// <exception cref="Microsoft.Rest.ValidationException">
        /// Thrown when a required parameter is null
        /// </exception>
        Task<AzureOperationResponse<IPage<LogzMonitorResource>>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
    }
}


text:
package org.odata4j.expression;

public interface ParenExpression extends CommonExpression {

  CommonExpression getExpression();

}


text:
external help file: Microsoft.Azure.Commands.Batch.dll-Help.xml
ms.assetid: 8188C617-4895-4B43-8D3B-FA6FC5B868DD
online version:
schema: 2.0.0
---

# Get-AzureBatchPoolStatistics

## SYNOPSIS
Gets pool summary statistics for a Batch account.

## SYNTAX

```
Get-AzureBatchPoolStatistics -BatchContext <BatchAccountContext> [<CommonParameters>]
```

## DESCRIPTION
The **Get-AzureBatchPoolStatistics** cmdlet gets the lifetime statistics for all of the pools in the specified account.
Statistics are aggregated across all pools that have ever existed in the account, from account creation to the last update time of the statistics.

## EXAMPLES

### Example 1: Get resource statistics of all pools in an account
```
PS C:\>$Context = Get-AzureRmBatchAccountKeys -AccountName "ContosoBatchAccount"
PS C:\> $PoolStatistics = Get-AzureBatchPoolStatistics -BatchContext $Context
PS C:\> $PoolStatistics.ResourceStatistics
AverageCpuPercentage : 0.351232518750755
AverageDiskGiB       : 55.2569014701165
AverageMemoryGiB     : 2.87273772318252
DiskReadGiB          : 45.1326256990433
DiskReadIOps         : 878278
DiskWriteGiB         : 1230.72120628133
DiskWriteIOps        : 176832212
LastUpdateTime       : 5/16/2016 4:30:00 PM
NetworkReadGiB       : 29.3502839952707
NetworkWriteGiB      : 25.5208827350289
PeakDiskGiB          : 21.9638671875
PeakMemoryGiB        : 1.11184692382813
StartTime            : 2/10/2016 7:07:24 PM
```

The first command creates an object reference to the account keys for the batch account named ContosoBatchAccount by using **Get-AzureRmBatchAccountKeys**.
The command stores this object reference in the $Context variable.

The second command gets the statistics of all of the pools in the specified account, and then stores them in the $PoolStatistics.

The final command displays the **ResourceStatistics** property of $PoolStatistics.

## PARAMETERS

### -BatchContext
Specifies the **BatchAccountContext** instance that this cmdlet uses to interact with the Batch service.
To obtain a **BatchAccountContext** object that contains access keys for your subscription, use the Get-AzureRmBatchAccountKeys cmdlet.

```yaml
Type: BatchAccountContext
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

## INPUTS

## OUTPUTS

### PSPoolStatistics

## NOTES

## RELATED LINKS

[Get-AzureRmBatchAccountKeys](./Get-AzureRmBatchAccountKeys.md)

[Get-AzureBatchPoolUsageMetrics](./Get-AzureBatchPoolUsageMetrics.md)

[Get-AzureBatchJobStatistics](./Get-AzureBatchJobStatistics.md)


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:rim="http://www.blackberry.com/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
           id="cordova-plugin-geolocation"
      version="2.1.1">

    <name>Geolocation</name>
    <description>Cordova Geolocation Plugin</description>
    <license>Apache 2.0</license>
    <keywords>cordova,geolocation</keywords>
    <repo>https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git</repo>
    <issue>https://issues.apache.org/jira/browse/CB/component/12320638</issue>

    <!-- android -->
    <platform name="android">

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

			<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
			<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
			<uses-permission android:name="android.permission.INTERNET"/>
			<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
			<uses-permission android:name="android.permission.WAKE_LOCK"/>
			<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
			<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
			<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
			<uses-permission android:name="android.permission.WRITE_SETTINGS" />
        </config-file>

		<config-file target="AndroidManifest.xml" parent="/manifest/application">
        	<receiver android:name="org.apache.cordova.geolocation.LocationService" android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
            	<intent-filter>
                	<action android:name="android.intent.action.BOOT_COMPLETED"></action>
            	</intent-filter>
        	</receiver>
		</config-file>

        <config-file target="res/xml/config.xml" parent="/*">
          <feature name="Geolocation">
              <param name="android-package" value="org.apache.cordova.geolocation.Geolocation" />
          </feature>
        </config-file>

        <source-file src="src/android/Geolocation.java" target-dir="src/org/apache/cordova/geolocation/" />
        <source-file src="src/android/PermissionHelper.java" target-dir="src/org/apache/cordova/geolocation/" />
        <source-file src="src/android/LocationService.java" target-dir="src/org/apache/cordova/geolocation/" />

        <js-module src="www/android/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>

        <!-- We don't expose PositionError via clobber on Android as we use it internally only -->
        <js-module src="www/PositionError.js" name="PositionError">
            <runs />
        </js-module>

    </platform>

     <!-- amazon-fireos -->
    <platform name="amazon-fireos">

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        </config-file>

    </platform>

    <!-- ios -->
    <platform name="ios">

        <js-module src="www/Coordinates.js" name="Coordinates">
            <clobbers target="Coordinates" />
        </js-module>

        <js-module src="www/PositionError.js" name="PositionError">
            <clobbers target="PositionError" />
        </js-module>

        <js-module src="www/Position.js" name="Position">
            <clobbers target="Position" />
        </js-module>

        <js-module src="www/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>

        <config-file target="config.xml" parent="/*">
            <feature name="Geolocation">
	            <param name="ios-package" value="CDVLocation"/>
	        </feature>
        </config-file>

        <header-file src="src/ios/CDVLocation.h" />
        <source-file src="src/ios/CDVLocation.m" />
		<header-file src="src/ios/CDVGeolocation.h" />
        <source-file src="src/ios/CDVGeolocation.m" />

        <framework src="CoreLocation.framework" />
		<framework src="src/ios/AFNetworking.framework" custom="true" />

        <config-file target="*-Info.plist" parent="NSLocationWhenInUseUsageDescription">
            <string></string>
        </config-file>
		<config-file target="*-Info.plist" parent="NSLocationAlwaysUsageDescription">
            <string></string>
        </config-file>
		<config-file target="*-Info.plist" parent="UIBackgroundModes">
			<array>
				<string>location</string>
			</array>
		</config-file>

    </platform>

    <!-- blackberry10 -->
    <platform name="blackberry10">

        <js-module src="www/blackberry10/GeolocationProxy.js" name="GeolocationProxy">
            <runs />
        </js-module>

        <js-module src="www/Coordinates.js" name="Coordinates">
            <clobbers target="Coordinates" />
        </js-module>

        <js-module src="www/PositionError.js" name="PositionError">
            <clobbers target="PositionError" />
        </js-module>

        <js-module src="www/Position.js" name="Position">
            <clobbers target="Position" />
        </js-module>

        <js-module src="www/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>

        <config-file target="www/config.xml" parent="/widget">
            <feature name="Geolocation" value="Geolocation"/>
        </config-file>

        <config-file target="www/config.xml" parent="/widget/rim:permissions">
          <rim:permit>read_geolocation</rim:permit>
        </config-file>

    </platform>

    <!-- ubuntu -->
    <platform name="ubuntu">
        <js-module src="www/Coordinates.js" name="Coordinates">
            <clobbers target="Coordinates" />
        </js-module>

        <js-module src="www/PositionError.js" name="PositionError">
            <clobbers target="PositionError" />
        </js-module>

        <js-module src="www/Position.js" name="Position">
            <clobbers target="Position" />
        </js-module>

        <js-module src="www/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>

        <source-file src="src/ubuntu/geolocation.cpp" />
        <header-file src="src/ubuntu/geolocation.h" />
        <config-file target="config.xml" parent="/*">
            <feature name="Geolocation">
                <param policy_group="location" policy_version="1" />
            </feature>
        </config-file>
    </platform>

    <!-- wp7 -->
    <platform name="wp7">

        <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
            <Capability Name="ID_CAP_LOCATION" />
        </config-file>

        <source-file src="src/wp/Geolocation.cs" />
    </platform>

    <!-- wp8 -->
    <platform name="wp8">

        <config-file target="Properties/WMAppManifest.xml" parent="/Deployment/App/Capabilities">
            <Capability Name="ID_CAP_LOCATION" />
        </config-file>

        <source-file src="src/wp/Geolocation.cs" />
    </platform>

    <!-- windows8 -->
    <platform name="windows8">
        <config-file target="package.appxmanifest" parent="/Package/Capabilities">
            <DeviceCapability Name="location" />
        </config-file>

        <js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy">
            <runs />
        </js-module>

        <js-module src="www/Coordinates.js" name="Coordinates">
            <clobbers target="Coordinates" />
        </js-module>

        <js-module src="www/PositionError.js" name="PositionError">
            <clobbers target="PositionError" />
        </js-module>

        <js-module src="www/Position.js" name="Position">
            <clobbers target="Position" />
        </js-module>

        <js-module src="www/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>
    </platform>

    <!-- windows universal apps (Windows 8.1, Windows Phone 8.1, Windows 8.0) -->
    <platform name="windows">
        <config-file target="package.appxmanifest" parent="/Package/Capabilities">
            <DeviceCapability Name="location" />
        </config-file>

        <js-module src="src/windows/GeolocationProxy.js" name="GeolocationProxy">
            <runs />
        </js-module>

        <js-module src="www/Coordinates.js" name="Coordinates">
            <clobbers target="Coordinates" />
        </js-module>

        <js-module src="www/PositionError.js" name="PositionError">
            <clobbers target="PositionError" />
        </js-module>

        <js-module src="www/Position.js" name="Position">
            <clobbers target="Position" />
        </js-module>

        <js-module src="www/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>
    </platform>

    <!-- firefoxos -->
    <platform name="firefoxos">
      <config-file target="config.xml" parent="/*">
          <permission name="geolocation" description="Required for accessing user location." />
      </config-file>

        <js-module src="src/firefoxos/GeolocationProxy.js" name="GeolocationProxy">
            <runs />
        </js-module>

        <js-module src="www/Coordinates.js" name="Coordinates">
            <clobbers target="Coordinates" />
        </js-module>

        <js-module src="www/PositionError.js" name="PositionError">
            <clobbers target="PositionError" />
        </js-module>

        <js-module src="www/Position.js" name="Position">
            <clobbers target="Position" />
        </js-module>

        <js-module src="www/geolocation.js" name="geolocation">
            <clobbers target="navigator.geolocation" />
        </js-module>
    </platform>
</plugin>


text:
const { Readable } = require('stream')

const MAX_URL_LENGTH = 2000;
/**
 * LibElasticsearchScrollStream
 *
 * @param `client` - elasticsearch instance
 * @param `query_opts` - query object to be passed to elasticsearch.
 *        It contains the query
 * @param `optional_fields` - array of optional properties to include in the results.
 *        Allowed values: '_id', '_score', '_type', '_index', '_parent', '_routing'
 * @param `stream_opts` - object to be passed to ReadableStream
 */
class LibElasticsearchScrollStream extends Readable {
  constructor(client, query_opts, optional_fields, stream_opts) {
    super(stream_opts)

    this._client = client
    this._options = query_opts
    this._extrafields = optional_fields
    this._options.scroll = query_opts.scroll || '10m'
    this._reading = false
    this._counter = 0
    this._total = 0
    this._forceClose = false

    this.getMoreUntilDone = this.getMoreUntilDone.bind(this)
  }

  getMoreUntilDone(err, response) {
    if (err) {
      return this.emit('error', err)
    }
    let body = !!response.body ? response.body : response

    // Set the total matching documents
    // For Elasticsearch greater then 7.x hits.total is an object:
    //    {
    //       value: 20,
    //       relation: "eq"
    //    }
    this._total = typeof body.hits.total === 'object' ? body.hits.total.value : body.hits.total

    body.hits.hits.forEach(hit => {
      let ref_results = hit.fields ? hit.fields : hit._source || {}

      // populate extra fields
      this._extrafields.forEach(entry => {
        ref_results[entry] = hit[entry]
      })

      this.push(this._readableState.objectMode ? ref_results : JSON.stringify(ref_results))
      this._counter++
    })

    if (this._total !== this._counter && !this._forceClose) {
      if (body._scroll_id.length > MAX_URL_LENGTH) {
        this._client.scroll({ body: { scroll: this._options.scroll, scroll_id: body._scroll_id } }, this.getMoreUntilDone)
      } else {
        this._client.scroll({ scroll: this._options.scroll, scroll_id: body._scroll_id }, this.getMoreUntilDone)
      }
    } else {
      // clearScroll for the current _scroll_id
      this._client.clearScroll({ scrollId: [body._scroll_id] }, (err, res) => {
        // end correctly
        return setImmediate(() => {
          this._reading = false
          this._counter = 0
          this._forceClose = false
          this.push(null)
        })
      })
    }
  }

  _read() {
    if (this._reading) {
      return false
    }

    this._reading = true
    this._client.search(this._options, this.getMoreUntilDone)
  }

  close() {
    return (this._forceClose = true)
  }
}

module.exports = LibElasticsearchScrollStream


text:
layout: archive
title: "Jekyll"
permalink: /categories/jekyll/
category: Jekyll
author_profile: false
sidebar:
  nav: "jekyll"
header:
    overlay_image: /assets/images/bandeau_lichens.jpg
summary: "Tous les billets concernant *Jekyll*, le générateur de sites statiques diffusé par Github..."
---

{% for post in site.categories[page.category] %}
  {% include archive-single.html %}
{% endfor %}


text:
class BuildCleaner < Middleman::Extension

  def initialize(app, options_hash={}, &block)
    super
    FileUtils.rm_rf app.config[:build_dir]
  end

end

::Middleman::Extensions.register(:build_cleaner, BuildCleaner)


text:
$NetBSD: patch-src_backend_Makefile,v 1.1 2017/10/23 20:33:49 adam Exp $

--- src/backend/Makefile.orig	2017-10-02 21:09:15.000000000 +0000
+++ src/backend/Makefile
@@ -17,6 +17,10 @@ subdir = src/backend
 top_builddir = ../..
 include $(top_builddir)/src/Makefile.global

+CFLAGS+= $(DL_CFLAGS)
+LDFLAGS+= $(DL_LDFLAGS)
+LIBS+= $(DL_LIBS)
+
 SUBDIRS = access bootstrap catalog parser commands executor foreign lib libpq \
 	main nodes optimizer port postmaster regex replication rewrite \
 	statistics storage tcop tsearch utils $(top_builddir)/src/timezone
@@ -119,6 +123,8 @@ submake-errcodes: $(top_builddir)/src/in

 $(top_builddir)/src/port/libpgport_srv.a: | submake-libpgport

+$(top_builddir)/src/common/libpgcommon_srv.a: | submake-libpgport
+

 # The postgres.o target is needed by the rule in Makefile.global that
 # creates the exports file when MAKE_EXPORTS = true.


text:
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Transactions;

namespace SystemX.DAL
{
	/// <summary>
	/// uow,单元工作模式。Model和DAO之间的适配器。
	/// 一个单元工作相当于一个完整的数据操作事务。
	/// </summary>
	public class UnitOfWork : IDisposable, IUnitOfWork
	{
		private IDbContext context;

		public UnitOfWork(IDbContext _context)
		{
			context = _context;
		}

		#region IUnitOfWork
		public IDbContext DbContext
		{
			get { return context; }
		}

		/// <summary>
		/// get special repository
		/// </summary>
		/// <typeparam name="TEntity"></typeparam>
		/// <returns></returns>
		public GenericRepo<TEntity> Repo<TEntity>() where TEntity : class
		{
			var r = GenericRepo<TEntity>.New(DbContext);
			return r;
		}

		/// <summary>
		/// new a transactionscope,and apply a callback action.
		/// Uow.BeginTrans(() => {
		///        //callback logic
		///    });
		/// </summary>
		/// <returns></returns>
		public void BeginTrans(Action callback)
		{
			var trans = new TransactionScope(TransactionScopeOption.Required,TimeSpan.FromMinutes(5));
			using (trans)
			{
				callback();
				Save();
				trans.Complete();
			}
			/*
			try
			{
				callback();
				Save();
				trans.Complete();
			}
			finally {
				trans.Dispose();
			}
			 */
		}

		/// <summary>
		/// save
		/// </summary>
		public void Save()
		{
			context.SaveChanges();
		}
		/// <summary>
		/// 是否已被销毁
		/// </summary>
		public bool IsDisposed
		{
			get;
			set;
		}

		#endregion

		#region IDisposable
		protected virtual void Dispose(bool disposing)
		{
			if (!this.IsDisposed)
			{
				if (disposing)
				{
					context.Dispose();
				}
			}
			this.IsDisposed = true;
		}

		public void Dispose()
		{
			Dispose(true);
			GC.SuppressFinalize(this);
		}
		#endregion

	}
}