text:
(function(window) {

  /** Use a single "load" function */
  var load = typeof require == 'function' ? require : window.load;

  /** The file path of the Lo-Dash file to test */
  var filePath = (function() {
    var min = 0;
    var result = window.phantom
      ? phantom.args
      : (window.system
          ? (min = 1, system.args)
          : (window.process ? (min = 2, process.argv) : (window.arguments || []))
        );

    var last = result[result.length - 1];
    result = (result.length > min && !/perf(?:\.js)?$/.test(last))
      ? last
      : '../lodash.js';

    try {
      result = require('fs').realpathSync(result);
    } catch(e) { }

    return result;
  }());

  /** Load Lo-Dash */
  var lodash = window.lodash || (window.lodash = (
    lodash = load(filePath) || window._,
    lodash = lodash._ || lodash,
    lodash.noConflict()
  ));

  /** Load Benchmark.js */
  var Benchmark = window.Benchmark || (window.Benchmark = (
    Benchmark = load('../vendor/benchmark.js/benchmark.js') || window.Benchmark,
    Benchmark = Benchmark.Benchmark || Benchmark,
    Benchmark.runInContext(lodash.extend({}, window, { '_': lodash }))
  ));

  /** Load Underscore */
  var _ = window._ || (window._ = (
    _ = load('../vendor/underscore/underscore.js') || window._,
    _._ || _
  ));

  /** Used to access the Firebug Lite panel (set by `run`) */
  var fbPanel;

  /** Used to match path separators */
  var rePathSeparator = /[\/\\]/;

  /** Used to detect primitive types */
  var rePrimitive = /^(?:boolean|number|string|undefined)$/;

  /** Used to match RegExp special characters */
  var reSpecialChars = /[.*+?^=!:${}()|[\]\/\\]/g;

  /** Used to score performance */
  var score = { 'a': [], 'b': [] };

  /** Used to queue benchmark suites */
  var suites = [];

  /** Used to resolve a value's internal [[Class]] */
  var toString = Object.prototype.toString;

  /** The `ui` object */
  var ui = window.ui || (window.ui = {
    'buildPath': basename(filePath, '.js'),
    'otherPath': 'underscore'
  });

  /** The Lo-Dash build basename */
  var buildName = window.buildName = basename(ui.buildPath, '.js');

  /** The other library basename */
  var otherName = window.otherName = basename(ui.otherPath, '.js');

  /** Detect if in a browser environment */
  var isBrowser = isHostType(window, 'document') && isHostType(window, 'navigator');

  /** Detect Java environment */
  var isJava = !isBrowser && /Java/.test(toString.call(window.java));

  /** Add `console.log()` support for Narwhal, Rhino, and RingoJS */
  var console = window.console || (window.console = { 'log': window.print });

  /*--------------------------------------------------------------------------*/

  /**
   * Gets the basename of the given `filePath`. If the file `extension` is passed,
   * it will be removed from the basename.
   *
   * @private
   * @param {String} path The file path to inspect.
   * @param {String} extension The extension to remove.
   * @returns {String} Returns the basename.
   */
  function basename(filePath, extension) {
    var result = (filePath || '').split(rePathSeparator).pop();
    return (arguments.length < 2)
      ? result
      : result.replace(RegExp(extension.replace(reSpecialChars, '\\$&') + '$'), '');
  }

  /**
   * Computes the geometric mean (log-average) of an array of values.
   * See http://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms.
   *
   * @private
   * @param {Array} array The array of values.
   * @returns {Number} The geometric mean.
   */
  function getGeometricMean(array) {
    return Math.pow(Math.E, lodash.reduce(array, function(sum, x) {
      return sum + Math.log(x);
    }, 0) / array.length) || 0;
  }

  /**
   * Gets the Hz, i.e. operations per second, of `bench` adjusted for the
   * margin of error.
   *
   * @private
   * @param {Object} bench The benchmark object.
   * @returns {Number} Returns the adjusted Hz.
   */
  function getHz(bench) {
    var result = 1 / (bench.stats.mean + bench.stats.moe);
    return isFinite(result) ? result : 0;
  }

  /**
   * Host objects can return type values that are different from their actual
   * data type. The objects we are concerned with usually return non-primitive
   * types of "object", "function", or "unknown".
   *
   * @private
   * @param {Mixed} object The owner of the property.
   * @param {String} property The property to check.
   * @returns {Boolean} Returns `true` if the property value is a non-primitive, else `false`.
   */
  function isHostType(object, property) {
    if (object == null) {
      return false;
    }
    var type = typeof object[property];
    return !rePrimitive.test(type) && (type != 'object' || !!object[property]);
  }

  /**
   * Logs text to the console.
   *
   * @private
   * @param {String} text The text to log.
   */
  function log(text) {
    console.log(text + '');
    if (fbPanel) {
      // scroll the Firebug Lite panel down
      fbPanel.scrollTop = fbPanel.scrollHeight;
    }
  }

  /**
   * Runs all benchmark suites.
   *
   * @private (@public in the browser)
   */
  function run() {
    fbPanel = (fbPanel = window.document && document.getElementById('FirebugUI')) &&
      (fbPanel = (fbPanel = fbPanel.contentWindow || fbPanel.contentDocument).document || fbPanel) &&
      fbPanel.getElementById('fbPanel1');

    log('\nSit back and relax, this may take a while.');
    suites[0].run({ 'async': !isJava });
  }

  /*--------------------------------------------------------------------------*/

  lodash.extend(Benchmark.Suite.options, {
    'onStart': function() {
      log('\n' + this.name + ':');
    },
    'onCycle': function(event) {
      log(event.target);
    },
    'onComplete': function() {
      for (var index = 0, length = this.length; index < length; index++) {
        var bench = this[index];
        if (bench.error) {
          var errored = true;
        }
      }
      if (errored) {
        log('There was a problem, skipping...');
      }
      else {
        var formatNumber = Benchmark.formatNumber,
            fastest = this.filter('fastest'),
            fastestHz = getHz(fastest[0]),
            slowest = this.filter('slowest'),
            slowestHz = getHz(slowest[0]),
            aHz = getHz(this[0]),
            bHz = getHz(this[1]);

        if (fastest.length > 1) {
          log('It\'s too close to call.');
          aHz = bHz = slowestHz;
        }
        else {
          var percent = ((fastestHz / slowestHz) - 1) * 100;

          log(
            fastest[0].name + ' is ' +
            formatNumber(percent < 1 ? percent.toFixed(2) : Math.round(percent)) +
            '% faster.'
          );
        }
        // add score adjusted for margin of error
        score.a.push(aHz);
        score.b.push(bHz);
      }
      // remove current suite from queue
      suites.shift();

      if (suites.length) {
        // run next suite
        suites[0].run({ 'async': !isJava });
      }
      else {
        var aMeanHz = getGeometricMean(score.a),
            bMeanHz = getGeometricMean(score.b),
            fastestMeanHz = Math.max(aMeanHz, bMeanHz),
            slowestMeanHz = Math.min(aMeanHz, bMeanHz),
            xFaster = fastestMeanHz / slowestMeanHz,
            percentFaster = formatNumber(Math.round((xFaster - 1) * 100)),
            message = 'is ' + percentFaster + '% ' + (xFaster == 1 ? '' : '(' + formatNumber(xFaster.toFixed(2)) + 'x) ') + 'faster than';

        // report results
        if (aMeanHz >= bMeanHz) {
          log('\n' + buildName + ' ' + message + ' ' + otherName + '.');
        } else {
          log('\n' + otherName + ' ' + message + ' ' + buildName + '.');
        }
      }
    }
  });

  /*--------------------------------------------------------------------------*/

  lodash.extend(Benchmark.options, {
    'async': true,
    'setup': '\
      var _ = window._,\
          lodash = window.lodash,\
          belt = this.name == buildName ? lodash : _;\
      \
      var index,\
          date = new Date,\
          limit = 20,\
          regexp = /x/,\
          object = {},\
          objects = Array(limit),\
          numbers = Array(limit),\
          fourNumbers = [5, 25, 10, 30],\
          nestedNumbers = [1, [2], [3, [[4]]]],\
          twoNumbers = [12, 23];\
      \
      for (index = 0; index < limit; index++) {\
        numbers[index] = index;\
        object["key" + index] = index;\
        objects[index] = { "num": index };\
      }\
      \
      if (typeof bind != "undefined") {\
        var thisArg = { "name": "moe" },\
            ctor = function() {};\
        \
        var func = function(greeting, punctuation) {\
          return greeting + ", " + this.name + (punctuation || ".");\
        };\
        \
        var _boundNormal = _.bind(func, thisArg),\
            _boundPartial = _.bind(func, thisArg, "hi");\
        \
        var lodashBoundNormal = lodash.bind(func, thisArg),\
            lodashBoundPartial = lodash.bind(func, thisArg, "hi");\
      }\
      \
      if (typeof bindAll != "undefined") {\
        var bindAllCount = -1,\
            bindAllObjects = Array(this.count);\
        \
        var funcNames = belt.reject(belt.functions(belt).slice(0, 40), function(funcName) {\
          return /^_/.test(funcName);\
        });\
        \
        // potentially expensive\n\
        for (index = 0; index < this.count; index++) {\
          bindAllObjects[index] = belt.reduce(funcNames, function(object, funcName) {\
            object[funcName] = belt[funcName];\
            return object;\
          }, {});\
        }\
      }\
      if (typeof chaining != "undefined") {\
        var _chaining = _.chain ? _(numbers).chain() : _(numbers),\
            lodashChaining = lodash(numbers);\
      }\
      if (typeof compact != "undefined") {\
        var uncompacted = numbers.slice();\
        uncompacted[2] = false;\
        uncompacted[6] = null;\
        uncompacted[18] = "";\
      }\
      \
      if (typeof countBy != "undefined" || typeof omit != "undefined") {\
        var wordToNumber = {\
          "one": 1,\
          "two": 2,\
          "three": 3,\
          "four": 4,\
          "five": 5,\
          "six": 6,\
          "seven": 7,\
          "eight": 8,\
          "nine": 9,\
          "ten": 10,\
          "eleven": 11,\
          "twelve": 12,\
          "thirteen": 13,\
          "fourteen": 14,\
          "fifteen": 15,\
          "sixteen": 16,\
          "seventeen": 17,\
          "eighteen": 18,\
          "nineteen": 19,\
          "twenty": 20,\
          "twenty-one": 21,\
          "twenty-two": 22,\
          "twenty-three": 23,\
          "twenty-four": 24,\
          "twenty-five": 25,\
          "twenty-six": 26,\
          "twenty-seven": 27,\
          "twenty-eight": 28,\
          "twenty-nine": 29,\
          "thirty": 30,\
          "thirty-one": 31,\
          "thirty-two": 32,\
          "thirty-three": 33,\
          "thirty-four": 34,\
          "thirty-five": 35,\
          "thirty-six": 36,\
          "thirty-seven": 37,\
          "thirty-eight": 38,\
          "thirty-nine": 39,\
          "forty": 40\
        };\
        \
        var words = belt.keys(wordToNumber).slice(0, limit);\
      }\
      \
      if (typeof isEqual != "undefined") {\
        var objectOfPrimitives = {\
          "boolean": true,\
          "number": 1,\
          "string": "a"\
        };\
        \
        var objectOfObjects = {\
          "boolean": new Boolean(true),\
          "number": new Number(1),\
          "string": new String("a")\
        };\
        \
        var object2 = {},\
            objects2 = Array(limit),\
            numbers2 = Array(limit),\
            nestedNumbers2 = [1, [2], [3, [[4]]]],\
            nestedNumbers3 = [1, [2], [5, [[6]]]],\
            simpleObject = { "a": 1 },\
            simpleObject2 = { "a": 2 },\
            simpleObjects = [simpleObject],\
            simpleObjects2 = [simpleObject2],\
            twoNumbers2 = [18, 27];\
        \
        for (index = 0; index < limit; index++) {\
          object2["key" + index] = index;\
          objects2[index] = { "num": index };\
          numbers2[index] = index;\
        }\
      }\
      \
      if (typeof multiArrays != "undefined") {\
        var twentyValues = Array(20),\
            twentyValues2 = Array(20),\
            twentyFiveValues = Array(25),\
            twentyFiveValues2 = Array(25),\
            thirtyValues = Array(30),\
            thirtyValues2 = Array(30),\
            fortyValues = Array(40),\
            fortyValues2 = Array(40),\
            fiftyValues = Array(50),\
            fiftyValues2 = Array(50),\
            seventyFiveValues = Array(75),\
            seventyFiveValues2 = Array(75),\
            oneHundredValues = Array(100),\
            oneHundredValues2 = Array(100),\
            twoHundredValues = Array(200),\
            twoHundredValues2 = Array(200),\
            lowerChars = "abcdefghijklmnopqrstuvwxyz".split(""),\
            upperChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");\
        \
        for (index = 0; index < 200; index++) {\
          if (index < 15) {\
            twentyValues[index] = lowerChars[index];\
            twentyValues2[index] = upperChars[index];\
          }\
          if (index < 20) {\
            twentyValues[index] =\
            twentyValues2[index] = index;\
            \
            twentyFiveValues[index] = lowerChars[index];\
            twentyFiveValues2[index] = upperChars[index];\
          }\
          if (index < 25) {\
            twentyFiveValues[index] =\
            twentyFiveValues2[index] = index;\
            \
            thirtyValues[index] =\
            fortyValues[index] =\
            fiftyValues[index] =\
            seventyFiveValues[index] =\
            oneHundredValues[index] =\
            twoHundredValues[index] = lowerChars[index];\
            \
            thirtyValues2[index] =\
            fortyValues2[index] =\
            fiftyValues2[index] =\
            seventyFiveValues2[index] =\
            oneHundredValues2[index] =\
            twoHundredValues2[index] = upperChars[index];\
          }\
          else {\
            if (index < 30) {\
              thirtyValues[index] =\
              thirtyValues2[index] = index;\
            }\
            if (index < 40) {\
              fortyValues[index] =\
              fortyValues2[index] = index;\
            }\
            if (index < 50) {\
              fiftyValues[index] =\
              fiftyValues2[index] = index;\
            }\
            if (index < 75) {\
              seventyFiveValues[index] =\
              seventyFiveValues2[index] = index;\
            }\
            if (index < 100) {\
              oneHundredValues[index] =\
              oneHundredValues2[index] = index;\
            }\
            twoHundredValues[index] =\
            twoHundredValues2[index] = index;\
          }\
        }\
      }\
      \
      if (typeof template != "undefined") {\
        var tplData = {\
          "header1": "Header1",\
          "header2": "Header2",\
          "header3": "Header3",\
          "header4": "Header4",\
          "header5": "Header5",\
          "header6": "Header6",\
          "list": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]\
        };\
        \
        var tpl =\
          "
" +\
          "
<%= header1 %>
" +\
          "
<%= header2 %>
" +\
          "
<%= header3 %>
" +\
          "
<%= header4 %>
" +\
          "
<%= header5 %>
" +\
          "
<%= header6 %>
" +\
          "
" +\
          "<% for (var index = 0, length = list.length; index < length; index++) { %>" +\
          "
<%= list[index] %>
" +\
          "<% } %>" +\
          "
" +\
          "
";\
        \
        var tplVerbose =\
          "
" +\
          "
<%= data.header1 %>
" +\
          "
<%= data.header2 %>
" +\
          "
<%= data.header3 %>
" +\
          "
<%= data.header4 %>
" +\
          "
<%= data.header5 %>
" +\
          "
<%= data.header6 %>
" +\
          "
" +\
          "<% for (var index = 0, length = data.list.length; index < length; index++) { %>" +\
          "
<%= data.list[index] %>
" +\
          "<% } %>" +\
          "
" +\
          "
";\
        \
        var settingsObject = { "variable": "data" };\
        \
        var _tpl = _.template(tpl),\
            _tplVerbose = _.template(tplVerbose, null, settingsObject);\
        \
        var lodashTpl = lodash.template(tpl),\
            lodashTplVerbose = lodash.template(tplVerbose, null, settingsObject);\
      }\
      if (typeof where != "undefined") {\
        var _findWhere = _.findWhere || _.find,\
            lodashFindWhere = lodash.findWhere || lodash.find,\
            whereObject = { "num": 9 };\
      }\
      if (typeof zip != "undefined") {\
        var unzipped = [["a", "b", "c"], [1, 2, 3], [true, false, true]],\
            zipped = [["a", 1, true], ["b", 2, false], ["c", 3, true]];\
      }'
  });

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_(...)` with a number')
      .add(buildName, '\
        lodash(2)'
      )
      .add(otherName, '\
        _(2)'
      )
  );

  suites.push(
    Benchmark.Suite('`_(...)` with an array')
      .add(buildName, '\
        lodash(numbers)'
      )
      .add(otherName, '\
        _(numbers)'
      )
  );

  suites.push(
    Benchmark.Suite('`_(...)` with an object')
      .add(buildName, '\
        lodash(object)'
      )
      .add(otherName, '\
        _(object)'
      )
  );

  // avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
  if (!isJava) {
    suites.push(
      Benchmark.Suite('`_(...).tap(...)`')
        .add(buildName, {
          'fn': 'lodashChaining.tap(lodash.identity)',
          'teardown': 'function chaining(){}'
        })
        .add(otherName, {
          'fn':  '_chaining.tap(_.identity)',
          'teardown': 'function chaining(){}'
        })
    );
  }

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.bind` (uses native `Function#bind` if available and inferred fast)')
      .add(buildName, {
        'fn': 'lodash.bind(func, { "name": "moe" }, "hi")',
        'teardown': 'function bind(){}'
      })
      .add(otherName, {
        'fn': '_.bind(func, { "name": "moe" }, "hi")',
        'teardown': 'function bind(){}'
      })
  );

  suites.push(
    Benchmark.Suite('bound call')
      .add(buildName, {
        'fn': 'lodashBoundNormal()',
        'teardown': 'function bind(){}'
      })
      .add(otherName, {
        'fn': '_boundNormal()',
        'teardown': 'function bind(){}'
      })
  );

  suites.push(
    Benchmark.Suite('bound call with arguments')
      .add(buildName, {
        'fn': 'lodashBoundNormal("hi", "!")',
        'teardown': 'function bind(){}'
      })
      .add(otherName, {
        'fn': '_boundNormal("hi", "!")',
        'teardown': 'function bind(){}'
      })
  );

  suites.push(
    Benchmark.Suite('bound and partially applied call (uses native `Function#bind` if available)')
      .add(buildName, {
        'fn': 'lodashBoundPartial()',
        'teardown': 'function bind(){}'
      })
      .add(otherName, {
        'fn': '_boundPartial()',
        'teardown': 'function bind(){}'
      })
  );

  suites.push(
    Benchmark.Suite('bound and partially applied call with arguments (uses native `Function#bind` if available)')
      .add(buildName, {
        'fn': 'lodashBoundPartial("!")',
        'teardown': 'function bind(){}'
      })
      .add(otherName, {
        'fn': '_boundPartial("!")',
        'teardown': 'function bind(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.bindAll` iterating arguments')
      .add(buildName, {
        'fn': 'lodash.bindAll.apply(lodash, [bindAllObjects[++bindAllCount]].concat(funcNames))',
        'teardown': 'function bindAll(){}'
      })
      .add(otherName, {
        'fn': '_.bindAll.apply(_, [bindAllObjects[++bindAllCount]].concat(funcNames))',
        'teardown': 'function bindAll(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.bindAll` iterating the `object`')
      .add(buildName, {
        'fn': 'lodash.bindAll(bindAllObjects[++bindAllCount])',
        'teardown': 'function bindAll(){}'
      })
      .add(otherName, {
        'fn': '_.bindAll(bindAllObjects[++bindAllCount])',
        'teardown': 'function bindAll(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.clone` with an object')
      .add(buildName, '\
        lodash.clone(object)'
      )
      .add(otherName, '\
        _.clone(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.compact`')
      .add(buildName, {
        'fn': 'lodash.compact(uncompacted)',
        'teardown': 'function compact(){}'
      })
      .add(otherName, {
        'fn': '_.compact(uncompacted)',
        'teardown': 'function compact(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.contains` iterating an array')
      .add(buildName, '\
        lodash.contains(numbers, 19)'
      )
      .add(otherName, '\
        _.contains(numbers, 19)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.contains` iterating an object')
      .add(buildName, '\
        lodash.contains(object, 19)'
      )
      .add(otherName, '\
        _.contains(object, 19)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.countBy` with `callback` iterating an array')
      .add(buildName, '\
        lodash.countBy(numbers, function(num) { return num >> 1; })'
      )
      .add(otherName, '\
        _.countBy(numbers, function(num) { return num >> 1; })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.countBy` with `property` name iterating an array')
      .add(buildName, {
        'fn': 'lodash.countBy(words, "length")',
        'teardown': 'function countBy(){}'
      })
      .add(otherName, {
        'fn': '_.countBy(words, "length")',
        'teardown': 'function countBy(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.countBy` with `callback` iterating an object')
      .add(buildName, {
        'fn': 'lodash.countBy(wordToNumber, function(num) { return num >> 1; })',
        'teardown': 'function countBy(){}'
      })
      .add(otherName, {
        'fn': '_.countBy(wordToNumber, function(num) { return num >> 1; })',
        'teardown': 'function countBy(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.defaults`')
      .add(buildName, '\
        lodash.defaults({ "key2": 2, "key6": 6, "key18": 18 }, object)'
      )
      .add(otherName, '\
        _.defaults({ "key2": 2, "key6": 6, "key18": 18 }, object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.difference`')
      .add(buildName, '\
        lodash.difference(numbers, twoNumbers, fourNumbers)'
      )
      .add(otherName, '\
        _.difference(numbers, twoNumbers, fourNumbers)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.difference` iterating 200 elements')
      .add(buildName, {
        'fn': 'lodash.difference(twoHundredValues, twoHundredValues2)',
        'teardown': 'function multiArrays(){}'
      })
      .add(otherName, {
        'fn': '_.difference(twoHundredValues, twoHundredValues2)',
        'teardown': 'function multiArrays(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.difference` iterating 20 and 40 elements')
      .add(buildName, {
        'fn': 'lodash.difference(twentyValues, fortyValues2)',
        'teardown': 'function multiArrays(){}'
      })
      .add(otherName, {
        'fn': '_.difference(twentyValues, fortyValues2)',
        'teardown': 'function multiArrays(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.each` iterating an array')
      .add(buildName, '\
        var result = [];\
        lodash.each(numbers, function(num) {\
          result.push(num * 2);\
        })'
      )
      .add(otherName, '\
        var result = [];\
        _.each(numbers, function(num) {\
          result.push(num * 2);\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.each` iterating an array with `thisArg` (slow path)')
      .add(buildName, '\
        var result = [];\
        lodash.each(numbers, function(num, index) {\
          result.push(num + this["key" + index]);\
        }, object)'
      )
      .add(otherName, '\
        var result = [];\
        _.each(numbers, function(num, index) {\
          result.push(num + this["key" + index]);\
        }, object)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.each` iterating an object')
      .add(buildName, '\
        var result = [];\
        lodash.each(object, function(num) {\
          result.push(num * 2);\
        })'
      )
      .add(otherName, '\
        var result = [];\
        _.each(object, function(num) {\
          result.push(num * 2);\
        })'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.every` iterating an array')
      .add(buildName, '\
        lodash.every(numbers, function(num) {\
          return num + "";\
        })'
      )
      .add(otherName, '\
        _.every(numbers, function(num) {\
          return num + "";\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.every` iterating an object')
      .add(buildName, '\
        lodash.every(object, function(num) {\
          return num + "";\
        })'
      )
      .add(otherName, '\
        _.every(object, function(num) {\
          return num + "";\
        })'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.extend`')
      .add(buildName, '\
        lodash.extend({}, object)'
      )
      .add(otherName, '\
        _.extend({}, object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.filter` iterating an array')
      .add(buildName, '\
        lodash.filter(numbers, function(num) {\
          return num % 2;\
        })'
      )
      .add(otherName, '\
        _.filter(numbers, function(num) {\
          return num % 2;\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.filter` iterating an array with `thisArg` (slow path)')
      .add(buildName, '\
        lodash.filter(numbers, function(num, index) {\
          return this["key" + index] % 2;\
        }, object)'
      )
      .add(otherName, '\
        _.filter(numbers, function(num, index) {\
           return this["key" + index] % 2;\
        }, object)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.filter` iterating an object')
      .add(buildName, '\
        lodash.filter(object, function(num) {\
          return num % 2\
        })'
      )
      .add(otherName, '\
        _.filter(object, function(num) {\
          return num % 2\
        })'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.find` iterating an array')
      .add(buildName, '\
        lodash.find(numbers, function(num) {\
          return num === 19;\
        })'
      )
      .add(otherName, '\
        _.find(numbers, function(num) {\
          return num === 19;\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.find` iterating an object')
      .add(buildName, '\
        lodash.find(object, function(value, key) {\
          return /\D9$/.test(key);\
        })'
      )
      .add(otherName, '\
        _.find(object, function(value, key) {\
          return /\D9$/.test(key);\
        })'
      )
  );

  // avoid Underscore induced `OutOfMemoryError` in Rhino, Narwhal, and Ringo
  if (!isJava) {
    suites.push(
      Benchmark.Suite('`_.find` with `properties`')
        .add(buildName, {
          'fn': 'lodashFindWhere(objects, whereObject)',
          'teardown': 'function where(){}'
        })
        .add(otherName, {
          'fn': '_findWhere(objects, whereObject)',
          'teardown': 'function where(){}'
        })
    );
  }

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.flatten`')
      .add(buildName, '\
        lodash.flatten(nestedNumbers)'
      )
      .add(otherName, '\
        _.flatten(nestedNumbers)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.flatten` with `shallow`')
      .add(buildName, '\
        lodash.flatten(nestedNumbers, true)'
      )
      .add(otherName, '\
        _.flatten(nestedNumbers, true)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.functions`')
      .add(buildName, '\
        lodash.functions(lodash)'
      )
      .add(otherName, '\
        _.functions(lodash)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.groupBy` with `callback` iterating an array')
      .add(buildName, '\
        lodash.groupBy(numbers, function(num) { return num >> 1; })'
      )
      .add(otherName, '\
        _.groupBy(numbers, function(num) { return num >> 1; })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.groupBy` with `property` name iterating an array')
      .add(buildName, {
        'fn': 'lodash.groupBy(words, "length")',
        'teardown': 'function countBy(){}'
      })
      .add(otherName, {
        'fn': '_.groupBy(words, "length")',
        'teardown': 'function countBy(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.groupBy` with `callback` iterating an object')
      .add(buildName, {
        'fn': 'lodash.groupBy(wordToNumber, function(num) { return num >> 1; })',
        'teardown': 'function countBy(){}'
      })
      .add(otherName, {
        'fn': '_.groupBy(wordToNumber, function(num) { return num >> 1; })',
        'teardown': 'function countBy(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.indexOf`')
      .add(buildName, {
        'fn': 'lodash.indexOf(twoHundredValues, 199)',
        'teardown': 'function multiArrays(){}'
      })
      .add(buildName, {
        'fn': '_.indexOf(twoHundredValues, 199)',
        'teardown': 'function multiArrays(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.intersection`')
      .add(buildName, '\
        lodash.intersection(numbers, twoNumbers, fourNumbers)'
      )
      .add(otherName, '\
        _.intersection(numbers, twoNumbers, fourNumbers)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.intersection` iterating 200 elements')
      .add(buildName, {
        'fn': 'lodash.intersection(twoHundredValues, twoHundredValues2)',
        'teardown': 'function multiArrays(){}'
      })
      .add(otherName, {
        'fn': '_.intersection(twoHundredValues, twoHundredValues2)',
        'teardown': 'function multiArrays(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.invert`')
      .add(buildName, '\
        lodash.invert(object)'
      )
      .add(otherName, '\
        _.invert(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.invoke` iterating an array')
      .add(buildName, '\
        lodash.invoke(numbers, "toFixed", "2")'
      )
      .add(otherName, '\
        _.invoke(numbers, "toFixed", "2")'
      )
  );

  suites.push(
    Benchmark.Suite('`_.invoke` with a function for `methodName` iterating an array')
      .add(buildName, '\
        lodash.invoke(numbers, String.prototype.split, "")'
      )
      .add(otherName, '\
        _.invoke(numbers, String.prototype.split, "")'
      )
  );

  suites.push(
    Benchmark.Suite('`_.invoke` iterating an object')
      .add(buildName, '\
        lodash.invoke(object, "toFixed", "2")'
      )
      .add(otherName, '\
        _.invoke(object, "toFixed", "2")'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.isEqual` comparing primitives and objects (edge case)')
      .add(buildName, {
        'fn': 'lodash.isEqual(objectOfPrimitives, objectOfObjects)',
        'teardown': 'function isEqual(){}'
      })
      .add(otherName, {
        'fn': '_.isEqual(objectOfPrimitives, objectOfObjects)',
        'teardown': 'function isEqual(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.isEqual` comparing arrays')
      .add(buildName, {
        'fn': '\
          lodash.isEqual(numbers, numbers2);\
          lodash.isEqual(twoNumbers, twoNumbers2)',
        'teardown': 'function isEqual(){}'
      })
      .add(otherName, {
        'fn': '\
          _.isEqual(numbers, numbers2);\
          _.isEqual(twoNumbers, twoNumbers2)',
        'teardown': 'function isEqual(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.isEqual` comparing nested arrays')
      .add(buildName, {
        'fn': '\
          lodash.isEqual(nestedNumbers, nestedNumbers2);\
          lodash.isEqual(nestedNumbers2, nestedNumbers3)',
        'teardown': 'function isEqual(){}'
      })
      .add(otherName, {
        'fn': '\
          _.isEqual(nestedNumbers, nestedNumbers2);\
          _.isEqual(nestedNumbers2, nestedNumbers3)',
        'teardown': 'function isEqual(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.isEqual` comparing arrays of objects')
      .add(buildName, {
        'fn': '\
          lodash.isEqual(objects, objects2);\
          lodash.isEqual(simpleObjects, simpleObjects2)',
        'teardown': 'function isEqual(){}'
      })
      .add(otherName, {
        'fn': '\
          _.isEqual(objects, objects2);\
          _.isEqual(simpleObjects, simpleObjects2)',
        'teardown': 'function isEqual(){}'
      })
  );

  suites.push(
    Benchmark.Suite('`_.isEqual` comparing objects')
      .add(buildName, {
        'fn': '\
          lodash.isEqual(object, object2);\
          lodash.isEqual(simpleObject, simpleObject2)',
        'teardown': 'function isEqual(){}'
      })
      .add(otherName, {
        'fn': '\
          _.isEqual(object, object2);\
          _.isEqual(simpleObject, simpleObject2)',
        'teardown': 'function isEqual(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.isArguments`, `_.isDate`, `_.isFunction`, `_.isNumber`, `_.isObject`, `_.isRegExp`')
      .add(buildName, '\
        lodash.isArguments(arguments);\
        lodash.isArguments(object);\
        lodash.isDate(date);\
        lodash.isDate(object);\
        lodash.isFunction(lodash);\
        lodash.isFunction(object);\
        lodash.isNumber(1);\
        lodash.isNumber(object);\
        lodash.isObject(object);\
        lodash.isObject(1);\
        lodash.isRegExp(regexp);\
        lodash.isRegExp(object)'
      )
      .add(otherName, '\
        _.isArguments(arguments);\
        _.isArguments(object);\
        _.isDate(date);\
        _.isDate(object);\
        _.isFunction(_);\
        _.isFunction(object);\
        _.isNumber(1);\
        _.isNumber(object);\
        _.isObject(object);\
        _.isObject(1);\
        _.isRegExp(regexp);\
        _.isRegExp(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.keys` (uses native `Object.keys` if available)')
      .add(buildName, '\
        lodash.keys(object)'
      )
      .add(otherName, '\
        _.keys(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.lastIndexOf`')
      .add(buildName, '\
        lodash.lastIndexOf(numbers, 9)'
      )
      .add(otherName, '\
        _.lastIndexOf(numbers, 9)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.map` iterating an array')
      .add(buildName, '\
        lodash.map(objects, function(value) {\
          return value.num;\
        })'
      )
      .add(otherName, '\
        _.map(objects, function(value) {\
          return value.num;\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.map` with `thisArg` iterating an array (slow path)')
      .add(buildName, '\
        lodash.map(objects, function(value, index) {\
          return this["key" + index] + value.num;\
        }, object)'
      )
      .add(otherName, '\
        _.map(objects, function(value, index) {\
          return this["key" + index] + value.num;\
        }, object)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.map` iterating an object')
      .add(buildName, '\
        lodash.map(object, function(value) {\
          return value;\
        })'
      )
      .add(otherName, '\
        _.map(object, function(value) {\
          return value;\
        })'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.max`')
      .add(buildName, '\
        lodash.max(numbers)'
      )
      .add(otherName, '\
        _.max(numbers)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.min`')
      .add(buildName, '\
        lodash.min(numbers)'
      )
      .add(otherName, '\
        _.min(numbers)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.omit` iterating 20 properties, omitting 2 keys')
      .add(buildName, '\
        lodash.omit(object, "key6", "key13")'
      )
      .add(otherName, '\
        _.omit(object, "key6", "key13")'
      )
  );

  suites.push(
    Benchmark.Suite('`_.omit` iterating 40 properties, omitting 20 keys')
      .add(buildName, {
        'fn': 'lodash.omit(wordToNumber, words)',
        'teardown': 'function omit(){}'
      })
      .add(otherName, {
        'fn': '_.omit(wordToNumber, words)',
        'teardown': 'function omit(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.pairs`')
      .add(buildName, '\
        lodash.pairs(object)'
      )
      .add(otherName, '\
        _.pairs(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.pick`')
      .add(buildName, '\
        lodash.pick(object, "key6", "key13")'
      )
      .add(otherName, '\
        _.pick(object, "key6", "key13")'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.pluck`')
      .add(buildName, '\
        lodash.pluck(objects, "num")'
      )
      .add(otherName, '\
        _.pluck(objects, "num")'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.reduce` iterating an array')
      .add(buildName, '\
        lodash.reduce(numbers, function(result, value, index) {\
          result[index] = value;\
          return result;\
        }, {})'
      )
      .add(otherName, '\
        _.reduce(numbers, function(result, value, index) {\
          result[index] = value;\
          return result;\
        }, {})'
      )
  );

  suites.push(
    Benchmark.Suite('`_.reduce` iterating an object')
      .add(buildName, '\
        lodash.reduce(object, function(result, value, key) {\
          result.push(key, value);\
          return result;\
        }, [])'
      )
      .add(otherName, '\
        _.reduce(object, function(result, value, key) {\
          result.push(key, value);\
          return result;\
        }, [])'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.reduceRight` iterating an array')
      .add(buildName, '\
        lodash.reduceRight(numbers, function(result, value, index) {\
          result[index] = value;\
          return result;\
        }, {})'
      )
      .add(otherName, '\
        _.reduceRight(numbers, function(result, value, index) {\
          result[index] = value;\
          return result;\
        }, {})'
      )
  );

  suites.push(
    Benchmark.Suite('`_.reduceRight` iterating an object')
      .add(buildName, '\
        lodash.reduceRight(object, function(result, value, key) {\
          result.push(key, value);\
          return result;\
        }, [])'
      )
      .add(otherName, '\
        _.reduceRight(object, function(result, value, key) {\
          result.push(key, value);\
          return result;\
        }, [])'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.reject` iterating an array')
      .add(buildName, '\
        lodash.reject(numbers, function(num) {\
          return num % 2;\
        })'
      )
      .add(otherName, '\
        _.reject(numbers, function(num) {\
          return num % 2;\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.reject` iterating an array with `thisArg` (slow path)')
      .add(buildName, '\
        lodash.reject(numbers, function(num, index) {\
          return this["key" + index] % 2;\
        }, object)'
      )
      .add(otherName, '\
        _.reject(numbers, function(num, index) {\
           return this["key" + index] % 2;\
        }, object)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.reject` iterating an object')
      .add(buildName, '\
        lodash.reject(object, function(num) {\
          return num % 2\
        })'
      )
      .add(otherName, '\
        _.reject(object, function(num) {\
          return num % 2\
        })'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.shuffle`')
      .add(buildName, '\
        lodash.shuffle(numbers)'
      )
      .add(otherName, '\
        _.shuffle(numbers)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.size` with an object')
      .add(buildName, '\
        lodash.size(object)'
      )
      .add(otherName, '\
        _.size(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.some` iterating an array')
      .add(buildName, '\
        lodash.some(numbers, function(num) {\
          return num == 19;\
        })'
      )
      .add(otherName, '\
        _.some(numbers, function(num) {\
          return num == 19;\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.some` with `thisArg` iterating an array (slow path)')
      .add(buildName, '\
        lodash.some(objects, function(value, index) {\
          return this["key" + index] == 19;\
        }, object)'
      )
      .add(otherName, '\
        _.some(objects, function(value, index) {\
          return this["key" + index] == 19;\
        }, object)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.some` iterating an object')
      .add(buildName, '\
        lodash.some(object, function(num) {\
          return num == 19;\
        })'
      )
      .add(otherName, '\
        _.some(object, function(num) {\
          return num == 19;\
        })'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.sortBy` with `callback`')
      .add(buildName, '\
        lodash.sortBy(numbers, function(num) { return Math.sin(num); })'
      )
      .add(otherName, '\
        _.sortBy(numbers, function(num) { return Math.sin(num); })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.sortBy` with `callback` and `thisArg` (slow path)')
      .add(buildName, '\
        lodash.sortBy(numbers, function(num) { return this.sin(num); }, Math)'
      )
      .add(otherName, '\
        _.sortBy(numbers, function(num) { return this.sin(num); }, Math)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.sortBy` with `property` name')
      .add(buildName, {
        'fn': 'lodash.sortBy(words, "length")',
        'teardown': 'function countBy(){}'
      })
      .add(otherName, {
        'fn': '_.sortBy(words, "length")',
        'teardown': 'function countBy(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.sortedIndex` with `callback`')
      .add(buildName, {
        'fn': '\
          lodash.sortedIndex(words, "twenty-five", function(value) {\
            return wordToNumber[value];\
          })',
        'teardown': 'function countBy(){}'
      })
      .add(otherName, {
        'fn': '\
          _.sortedIndex(words, "twenty-five", function(value) {\
            return wordToNumber[value];\
          })',
        'teardown': 'function countBy(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.template` (slow path)')
      .add(buildName, {
        'fn': 'lodash.template(tpl, tplData)',
        'teardown': 'function template(){}'
      })
      .add(otherName, {
        'fn': '_.template(tpl, tplData)',
        'teardown': 'function template(){}'
      })
  );

  suites.push(
    Benchmark.Suite('compiled template')
      .add(buildName, {
        'fn': 'lodashTpl(tplData)',
        'teardown': 'function template(){}'
      })
      .add(otherName, {
        'fn': '_tpl(tplData)',
        'teardown': 'function template(){}'
      })
  );

  suites.push(
    Benchmark.Suite('compiled template without a with-statement')
      .add(buildName, {
        'fn': 'lodashTplVerbose(tplData)',
        'teardown': 'function template(){}'
      })
      .add(otherName, {
        'fn': '_tplVerbose(tplData)',
        'teardown': 'function template(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.times`')
      .add(buildName, '\
        var result = [];\
        lodash.times(limit, function(n) { result.push(n); })'
      )
      .add(otherName, '\
        var result = [];\
        _.times(limit, function(n) { result.push(n); })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.times` with `thisArg`')
      .add(buildName, '\
        var result = [];\
        lodash.times(limit, function(n) { result.push(this.sin(n)); }, Math)'
      )
      .add(otherName, '\
        var result = [];\
        _.times(limit, function(n) { result.push(this.sin(n)); }, Math)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.toArray` with an array (edge case)')
      .add(buildName, '\
        lodash.toArray(numbers)'
      )
      .add(otherName, '\
        _.toArray(numbers)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.toArray` with an object')
      .add(buildName, '\
        lodash.toArray(object)'
      )
      .add(otherName, '\
        _.toArray(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.union`')
      .add(buildName, '\
        lodash.union(numbers, twoNumbers, fourNumbers)'
      )
      .add(otherName, '\
        _.union(numbers, twoNumbers, fourNumbers)'
      )
  );

  suites.push(
    Benchmark.Suite('`_.union` iterating an array of 75 elements')
      .add(buildName, {
        'fn': 'lodash.union(fiftyValues, twentyFiveValues2)',
        'teardown': 'function multiArrays(){}'
      })
      .add(otherName, {
        'fn': '_.union(fiftyValues, twentyFiveValues2)',
        'teardown': 'function multiArrays(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.uniq`')
      .add(buildName, '\
        lodash.uniq(numbers.concat(twoNumbers, fourNumbers))'
      )
      .add(otherName, '\
        _.uniq(numbers.concat(twoNumbers, fourNumbers))'
      )
  );

  suites.push(
    Benchmark.Suite('`_.uniq` with `callback`')
      .add(buildName, '\
        lodash.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\
          return num % 2;\
        })'
      )
      .add(otherName, '\
        _.uniq(numbers.concat(twoNumbers, fourNumbers), function(num) {\
          return num % 2;\
        })'
      )
  );

  suites.push(
    Benchmark.Suite('`_.uniq` iterating an array of 200 elements')
      .add(buildName, {
        'fn': 'lodash.uniq(oneHundredValues.concat(oneHundredValues2))',
        'teardown': 'function multiArrays(){}'
      })
      .add(otherName, {
        'fn': '_.uniq(oneHundredValues.concat(oneHundredValues2))',
        'teardown': 'function multiArrays(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.unzip`')
      .add(buildName, {
        'fn': 'lodash.unzip(zipped)',
        'teardown': 'function zip(){}'
      })
      .add(otherName, {
        'fn': '_.unzip(zipped)',
        'teardown': 'function zip(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.values`')
      .add(buildName, '\
        lodash.values(object)'
      )
      .add(otherName, '\
        _.values(object)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.where`')
      .add(buildName, {
        'fn': 'lodash.where(objects, whereObject)',
        'teardown': 'function where(){}'
      })
      .add(otherName, {
        'fn': '_.where(objects, whereObject)',
        'teardown': 'function where(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.without`')
      .add(buildName, '\
        lodash.without(numbers, 9, 12, 14, 15)'
      )
      .add(otherName, '\
        _.without(numbers, 9, 12, 14, 15)'
      )
  );

  /*--------------------------------------------------------------------------*/

  suites.push(
    Benchmark.Suite('`_.zip`')
      .add(buildName, {
        'fn': 'lodash.zip.apply(lodash, unzipped)',
        'teardown': 'function zip(){}'
      })
      .add(otherName, {
        'fn': '_.zip.apply(_, unzipped)',
        'teardown': 'function zip(){}'
      })
  );

  /*--------------------------------------------------------------------------*/

  if (Benchmark.platform + '') {
    log(Benchmark.platform);
  }
  // in the browser, expose `run` to be called later
  if (window.document && !window.phantom) {
    window.run = run;
  } else {
    run();
  }
}(typeof global == 'object' && global || this));


text:
Deploy OpenStack all in one node using Ansible
==============================================

Deploy OpenStack to ubuntu host(ubuntu docker image)
----------------------------------------------------

The machine minimal requirements:

- two network interfaces.

The machine recommended requirements:

- two network interfaces.
- more than 8gb main memory.
- at least 40gb disk space.

It is generally a good idea to run a recent kernel. On Ubuntu LTS::

    sudo apt-get install linux-image-generic-lts-vivid
    sudo reboot

The guide assumes that you have build images using the following command.

::

    tools/build.py --registry 172.22.2.81:4000 --base ubuntu --type source --push

The IP, "172.22.2.81", is the host running private docker registry.
To deploy a private docker registry,
please read the document  DeployingRegistryServer_.

First, add ``--insecure-registry 172.22.2.81:4000``
to ``DOCKER_OPTS`` in ``/etc/default/docker``.
And restart the docker service.
This will permit Docker to pull from the deployment's private registry.

Clone the kolla repository and copy kolla config to ``"/etc"``:

::

    git clone https://github.com/openstack/kolla
    cd kolla
    cp -rf etc/kolla/ /etc/

And modify the file, ``"/etc/kolla/globals.yml"``. Do the below tasks.

- Set ``"kolla_base_distro"`` to ``"ubuntu"``.
- Set ``"kolla_install_type"`` to ``"source"``.
- Set ``"docker_registry"`` to ``"172.22.2.81:4000"``.
- Change kolla_internal_address value.
  Specify an unissued IP address in the deployment environment

Change the following values if needed:

- network_interface
- neutron_external_interface

After doing these tasks, run the following command in kolla directory:

::

    tools/kolla-ansible -i ansible/inventory/all-in-one -p ansible/site.yml deploy

Deployment takes between 10 and 15 minutes from
a local private registry on gigabit networks.

.. _DeployingRegistryServer: https://docs.docker.com/registry/deploying/

redpajama_set_name: RedPajamaGithub


text:
function checkanswers(stringAnswer) {
    var arrayQA = jsonCurr.a.split('').sort();
    var arrayMyA = stringAnswer.split('').sort();

    if (arrayQA.toString() != arrayMyA.toString()) {
        swal({
            title: "这题错了哦,再看看吧!",
            timer: 1200,
            showConfirmButton: false,
            type: "error"
        });
    } else {
        swal({
            title: "你做对啦,真棒!",
            timer: 900,
            showConfirmButton: false,
            imageUrl: "/images/thumbs-up.jpg"
        });
    }
}

function attachEvents() {
    window.stringAnswers = '';      // current user selections

    $('.doit-answer').each(function () {
        // eyecandy on mouse events
        $(this).mouseover(function () {
            $(this).addClass('doit-onmouse');
        });
        $(this).mouseout(function () {
            // cancel
            $(this).removeClass('doit-onmouse');
        });

        // on click any answer
        $(this).click(function () {
            // Log selections
            // TODO: satisfy multi answers

            // Storage current selection to stringAnswers
            var stringID = $(this).attr('id');
            var currID = Number(stringID.substr(stringID.length - 1));
            var stringAnswer = '';      // Answer of current selection
            if (!isNaN(currID)) {
                switch (currID) {
                    case 1:
                        stringAnswer = 'A';
                        break;
                    case 2:
                        stringAnswer = 'B';
                        break;
                    case 3:
                        stringAnswer = 'C';
                        break;
                    case 4:
                        stringAnswer = 'D';
                        break;
                }
                if ($(this).hasClass('doit-answer-selected')) {
                    // Removing already selected
                    $(this).removeClass('doit-answer-selected');
                    window.stringAnswers = window.stringAnswers.replace(stringAnswer, '');
                } else {
                    if (window.jsonCurr.a.length != 1) {
                        $(this).addClass('doit-answer-selected');
                        window.stringAnswers += stringAnswer;
                    } else {
                        $('.doit-answer').each(function () {
                            $(this).removeClass('doit-answer-selected');
                        });
                        $(this).addClass('doit-answer-selected');
                        window.stringAnswers = stringAnswer;
                        checkanswers(window.stringAnswers);
                    }
                }
            } else {
                alert("Wrong doit-answer elementID")
            }
        });
    });
    $('#doit-goleft').click(function () {
        window.curr -= 1;
        rendereverything();
        attachEvents();
    });
    $('#doit-goright').click(function () {
        window.curr += 1;
        rendereverything();
        attachEvents();
    });
}


text:
package com.shekhargulati.medium

import com.shekhargulati.medium.domainObjects.PostRequest
import okhttp3.mockwebserver.{MockResponse, MockWebServer}
import org.scalatest.{BeforeAndAfterEach, FunSpec, Matchers}

class MediumClientSpec extends FunSpec with Matchers with BeforeAndAfterEach {

  var server: MockWebServer = _

  override protected def beforeEach(): Unit = {
    server = new MockWebServer()
  }

  override protected def afterEach(): Unit = {
    server.shutdown()
  }

  describe("Medium Client") {

    describe("when getAuthorizationUrl is called") {

      it("should generate valid authorization URL") {
        val medium = MediumClient("test_client_id", "test_client_secret")
        val authorizationUrl = medium.getAuthorizationUrl("test_state", "https://example.com/me/callback", Array("basicProfile", "listPublications", "publishPost"))
        authorizationUrl should be("https://api.medium.com/m/oauth/authorize?client_id=test_client_id&scope=basicProfile,listPublications,publishPost&state=test_state&response_type=code&redirect_uri=https://example.com/me/callback")
      }
    }

    describe("when exchange access token for code is successful") {
      def fixture = new {
        val json =
          """
            |{
            |  "token_type": "Bearer",
            |  "access_token": "test-access-token",
            |  "refresh_token": "test-refresh-token",
            |  "scope": [
            |    "basicProfile",
            |    "listPublications",
            |    "publishPost"
            |  ],
            |  "expires_at": 1459842647035
            |}
          """.stripMargin
        server.enqueue(
          new MockResponse()
            .setBody(json)
            .setHeader("Content-Type", "application/json")
            .setHeader("charset", "utf-8")
        )
        server.start()

        val medium = new MediumClient("test_client_id", "test_client_secret") {
          override val baseApiUrl = server.url("/v1/tokens")
        }
      }

      it("then access token should be returned") {
        val f = fixture
        val accessToken = f.medium.exchangeAuthorizationCode("authorization_code", "http://www.example.com/")
        accessToken should have(
          'tokenType ("Bearer"),
          'accessToken ("test-access-token"),
          'refreshToken ("test-refresh-token"),
          'expiresAt (1459842647035L)
        )
        accessToken.scope should be(Array("basicProfile", "listPublications", "publishPost"))
      }

      it("then access token should be set in the medium client") {
        val f = fixture
        f.medium.exchangeAuthorizationCode("authorization_code", "http://www.example.com/")
        f.medium.accessToken should be(Some("test-access-token"))
      }

    }

    describe("when exchange access token for code gives error") {

      def fixture = new {
        val json =
          """
            |{
            |  "errors": [
            |    {
            |      "message": "Authorization code not found.",
            |      "code": 6016
            |    }
            |  ]
            |}
          """.stripMargin

        server.enqueue(
          new MockResponse()
            .setBody(json)
            .setResponseCode(401)
            .setHeader("Content-Type", "application/json")
            .setHeader("charset", "utf-8")
        )
        server.start()

        val medium = new MediumClient("test_client_id", "test_client_secret") {
          override val baseApiUrl = server.url("/v1/tokens")
        }
      }

      it("then MediumError should be thrown") {
        val f = fixture
        the[MediumException] thrownBy {
          f.medium.exchangeAuthorizationCode("test-code", "https://example.com/")
        }
      }
    }

    describe("when getting details of authenticated user") {

      def fixture = new {
        var json =
          """
            |{
            |  "data": {
            |    "id": "123",
            |    "username": "shekhargulati",
            |    "name": "Shekhar Gulati",
            |    "url": "https://medium.com/@shekhargulati",
            |    "imageUrl": "https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg"
            |  }
            |}
          """.stripMargin

        server.enqueue(new MockResponse()
          .setBody(json)
          .setHeader("Content-Type", "application/json")
          .setHeader("charset", "utf-8"))
        server.start()
      }

      it("then User details should be returned when access token is passed with request") {
        val f = fixture
        val medium = new MediumClient("test_client_id", "test_client_secret", Some("access_token")) {
          override val baseApiUrl = server.url("/v1/me")
        }
        val user = medium.getUser
        user should have(
          'id ("123"),
          'username ("shekhargulati"),
          'name ("Shekhar Gulati"),
          'url ("https://medium.com/@shekhargulati"),
          'imageUrl ("https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg")
        )
      }

      it("error should be thrown when access token is not provided") {
        val f = fixture
        val medium = new MediumClient("test_client_id", "test_client_secret") {
          override val baseApiUrl = server.url("/v1/me")
        }
        the[MediumException] thrownBy medium.getUser
      }

      def errorFixture = new {
        var json =
          """
            |{
            |  "errors": [
            |    {
            |      "message": "Token was invalid.",
            |      "code": 6003
            |    }
            |  ]
            |}
          """.stripMargin

        server.enqueue(new MockResponse()
          .setBody(json)
          .setHeader("Content-Type", "application/json")
          .setHeader("charset", "utf-8")
          .setResponseCode(401)
        )
        server.start()
      }

      it("error should be thrown when access token is invalid") {
        val f = errorFixture
        val medium = new MediumClient("test_client_id", "test_client_secret", Some("addd")) {
          override val baseApiUrl = server.url("/v1/me")
        }
        the[MediumException] thrownBy medium.getUser
      }
    }

    describe("when getting publications for a user") {

      def fixture = new {
        var json =
          """
            |{
            |  "data": [
            |    {
            |      "id": "668e14b18fb1",
            |      "name": "Signal v. Noise",
            |      "description": "Strong opinions and shared thoughts",
            |      "url": "https://medium.com/signal-v-noise",
            |      "imageUrl": "https://cdn-images-1.medium.com/fit/c/200/200/1*UUpa5mFtnLRLlT3nzi4FjQ.png"
            |    },
            |    {
            |      "id": "8d596e6c8706",
            |      "name": "The Realm",
            |      "description": "Inspiration from daily lives, creating pieces of philosophy, writing stories of travel",
            |      "url": "https://medium.com/the-realm",
            |      "imageUrl": "https://cdn-images-1.medium.com/fit/c/200/200/1*nSftJwCIFSBsBiTeC1WrEg.jpeg"
            |    },
            |    {
            |      "id": "bcc38c8f6edf",
            |      "name": "Matter",
            |      "description": "The story you?ve been missing.",
            |      "url": "https://medium.com/matter",
            |      "imageUrl": "https://cdn-images-1.medium.com/fit/c/200/200/1*Pr4CiPNL0HVDAUsq7agsIg.png"
            |    },
            |    {
            |      "id": "e358ae9bba4a",
            |      "name": "Editor?s Picks",
            |      "description": "Stories we think more people should notice. Edited by Medium staff. (At this time, we do not review unsolicited submissions.)",
            |      "url": "https://medium.com/editors-picks",
            |      "imageUrl": "https://cdn-images-1.medium.com/fit/c/200/200/1*3rvDqTClQaUVmFANOUgMmw.jpeg"
            |    }
            |  ]
            |}
          """.stripMargin

        server.enqueue(new MockResponse()
          .setBody(json)
          .setHeader("Content-Type", "application/json")
          .setHeader("charset", "utf-8"))
        server.start()
      }

      it("a sequence of publications should be returned") {
        val f = fixture
        val medium = new MediumClient("test_client_id", "test_client_secret", Some("access_token")) {
          override val baseApiUrl = server.url("/v1/users/test_user/publications")
        }

        val publications = medium.getPublicationsForUser("test_user")
        publications should have length 4
        publications.map(_.id) should be(Seq("668e14b18fb1", "8d596e6c8706", "bcc38c8f6edf", "e358ae9bba4a"))
      }
    }

    describe("when getting contributors for a publication") {
      def fixture = new {
        var json =
          """
            |{
            |  "data": [
            |    {
            |      "publicationId": "b45573563f5a",
            |      "userId": "13a06af8f81849c64dafbce822cbafbfab7ed7cecf82135bca946807ea351290d",
            |      "role": "editor"
            |    },
            |    {
            |      "publicationId": "b45573563f5a",
            |      "userId": "1c9c63b15b874d3e354340b7d7458d55e1dda0f6470074df1cc99608a372866ac",
            |      "role": "editor"
            |    },
            |    {
            |      "publicationId": "b45573563f5a",
            |      "userId": "1cc07499453463518b77d31650c0b53609dc973ad8ebd33690c7be9236e9384ad",
            |      "role": "editor"
            |    },
            |    {
            |      "publicationId": "b45573563f5a",
            |      "userId": "196f70942410555f4b3030debc4f199a0d5a0309a7b9df96c57b8ec6e4b5f11d7",
            |      "role": "writer"
            |    },
            |    {
            |      "publicationId": "b45573563f5a",
            |      "userId": "14d4a581f21ff537d245461b8ff2ae9b271b57d9554e25d863e3df6ef03ddd480",
            |      "role": "writer"
            |    }
            |  ]
            |}
          """.stripMargin

        server.enqueue(new MockResponse()
          .setBody(json)
          .setHeader("Content-Type", "application/json")
          .setHeader("charset", "utf-8"))
        server.start()
      }

      it("a sequence of contributor should be returned") {
        val f = fixture
        val medium = new MediumClient("test_client_id", "test_client_secret", Some("access_token")) {
          override val baseApiUrl = server.url("/v1/publications/my_publication_id/contributors")
        }

        val contributors = medium.getContributorsForPublication("my_publication_id")
        contributors should have length 5
      }

    }

    describe("when publishing a post") {

      def fixture = new {
        val responsJson =
          """
            |{
            | "data": {
            |   "id": "e6f36a",
            |   "title": "Liverpool FC",
            |   "authorId": "5303d74c64f66366f00cb9b2a94f3251bf5",
            |   "tags": ["football", "sport", "Liverpool"],
            |   "url": "https://medium.com/@majelbstoat/liverpool-fc-e6f36a",
            |   "canonicalUrl": "http://jamietalbot.com/posts/liverpool-fc",
            |   "publishStatus": "public",
            |   "publishedAt": 1442286338435,
            |   "license": "all-rights-reserved",
            |   "licenseUrl": "https://medium.com/policy/9db0094a1e0f"
            | }
            |}
          """.stripMargin

        server.enqueue(new MockResponse()
          .setBody(responsJson)
          .setHeader("Content-Type", "application/json")
          .setHeader("charset", "utf-8"))
        server.start()
      }

      it("should publish a new post") {
        val f = fixture
        val medium = new MediumClient("test_client_id", "test_client_secret", Some("access_token")) {
          override val baseApiUrl = server.url("/v1/users/123/posts")
        }

        val content =
          """
            |# Hello World
            |Hello how are you?
            |## What's up today?
            |Writing REST client for Medium API
          """.stripMargin
        val post = medium.createPost("123", PostRequest("Liverpool FC", "html", content))

        println(post)
        post.id should be("e6f36a")

      }
    }

    describe("when publishing a post under publication") {

      def fixture = new {
        val responsJson =
          """
            |{
            | "data": {
            |   "id": "e6f36a",
            |   "publicationId" :"e6f36a23",
            |   "title": "Liverpool FC",
            |   "authorId": "5303d74c64f66366f00cb9b2a94f3251bf5",
            |   "tags": ["football", "sport", "Liverpool"],
            |   "url": "https://medium.com/@majelbstoat/liverpool-fc-e6f36a",
            |   "canonicalUrl": "http://jamietalbot.com/posts/liverpool-fc",
            |   "publishStatus": "public",
            |   "publishedAt": 1442286338435,
            |   "license": "all-rights-reserved",
            |   "licenseUrl": "https://medium.com/policy/9db0094a1e0f"
            | }
            |}
          """.stripMargin

        server.enqueue(new MockResponse()
          .setBody(responsJson)
          .setHeader("Content-Type", "application/json")
          .setHeader("charset", "utf-8"))
        server.start()
      }

      it("should publish a new post") {
        val f = fixture
        val medium = new MediumClient("test_client_id", "test_client_secret", Some("access_token")) {
          override val baseApiUrl = server.url("/v1/publications/e6f36a23/posts")
        }

        val content =
          """
            |# Hello World
            |Hello how are you?
            |## What's up today?
            |Writing REST client for Medium API
          """.stripMargin
        val post = medium.createPostInPublication("123", PostRequest("Liverpool FC", "html", content))
        println(post)
        post.id should be("e6f36a")
        post.publicationId should be(Some("e6f36a23"))
      }
    }

  }

}


text:
@interface SeriesSelectionView : SingleChartLayout

@end


text:
require 'test/unit'
require 'bigdecimal'

class TestBigDecimal < Test::Unit::TestCase

  def test_bad_to_s_format_strings
    bd = BigDecimal.new("1")
    assert_equal("0.1E1", bd.to_s)
    assert_equal("+0.1E1", bd.to_s("+-2"))
    assert_equal("0.23", BigDecimal.new("0.23").to_s("F"))
  end

  def test_no_singleton_methods_on_bigdecimal
    num = BigDecimal.new("0.001")
    assert_raise(TypeError) { class << num ; def amethod ; end ; end }
    assert_raise(TypeError) { def num.amethod ; end }
  end

  def test_can_instantiate_big_decimal
    assert_nothing_raised {BigDecimal.new("4")}
    assert_nothing_raised {BigDecimal.new("3.14159")}
  end

  def test_can_implicitly_instantiate_big_decimal
    # JRUBY-153 issues
    assert_nothing_raised {BigDecimal("4")}
    assert_nothing_raised {BigDecimal("3.14159")}
  end

  def test_reject_arguments_not_responding_to_to_str
    assert_raise(TypeError) { BigDecimal.new(4) }
    assert_raise(TypeError) { BigDecimal.new(3.14159) }
    assert_raise(TypeError) { BigDecimal(4) }
    assert_raise(TypeError) { BigDecimal(3.14159) }
  end

  def test_alphabetic_args_return_zero
    assert_equal( BigDecimal("0.0"), BigDecimal("XXX"),
                  'Big Decimal objects instanitiated with a value that starts
                  with a letter should have a value of 0.0' )
  end

  class X
    def to_str; "3.14159" end
  end

  def test_can_accept_arbitrary_objects_as_arguments
    # as log as the object has a #to_str method...
    x = X.new
    assert_nothing_raised { BigDecimal.new(x) }
    assert_nothing_raised { BigDecimal(x) }
  end

  require "bigdecimal/newton"
  include Newton

  class Function
    def initialize()
      @zero = BigDecimal::new("0.0")
      @one  = BigDecimal::new("1.0")
      @two  = BigDecimal::new("2.0")
      @ten  = BigDecimal::new("10.0")
      @eps  = BigDecimal::new("1.0e-16")
    end
    def zero;@zero;end
    def one ;@one ;end
    def two ;@two ;end
    def ten ;@ten ;end
    def eps ;@eps ;end
    def values(x) # <= defines functions solved
      f = []
      f1 = x[0]*x[0] + x[1]*x[1] - @two # f1 = x**2 + y**2 - 2 => 0
      f2 = x[0] - x[1]                  # f2 = x    - y        => 0
      f <<= f1
      f <<= f2
      f
    end
  end

  def test_newton_extension
    f = BigDecimal::limit(100)
    f = Function.new
    x = [f.zero,f.zero]      # Initial values
    n = nlsolve(f,x)
    expected = [BigDecimal('0.1000000000262923315461642086010446338567975310185638386446002778855192224707966221794469725479649528E1'),
                BigDecimal('0.1000000000262923315461642086010446338567975310185638386446002778855192224707966221794469725479649528E1')]
    assert_equal expected, x
  end

  require "bigdecimal/math.rb"
  include BigMath

  def test_math_extension
    expected = BigDecimal('0.31415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066453462141417033006060218E1')
    # this test fails under C Ruby
    # ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-darwin8.9.1]
    assert_equal expected, PI(100)

    zero= BigDecimal("0")
    one = BigDecimal("1")
    two = BigDecimal("2")
    three = BigDecimal("3")

    assert_equal one * 1, one
    assert_equal one / 1, one
    assert_equal one + 1, two
    assert_equal one - 1, zero

    assert_equal zero, one % 1
    assert_equal one, three % two
    assert_equal BigDecimal("0.2"), BigDecimal("2.2") % two
    assert_equal BigDecimal("0.003"), BigDecimal("15.993") % BigDecimal("15.99")

    assert_equal 1*one, one
    assert_equal 1/one, one
    assert_equal 1+one, BigDecimal("2")
    assert_equal 1-one, BigDecimal("0")

    assert_equal one * 1.0, 1.0
    assert_equal one / 1.0, 1.0
    assert_equal one + 1.0, 2.0
    assert_equal one - 1.0, 0.0

    assert_equal 1.0*one, 1.0
    assert_equal 1.0/one, 1.0
    assert_equal 1.0+one, 2.0
    assert_equal 1.0-one, 0.0

    assert_equal("1.0", BigDecimal.new('1.0').to_s('F'))
    assert_equal("0.0", BigDecimal.new('0.0').to_s)

    assert_equal(BigDecimal("2"), BigDecimal("1.5").round)
    assert_equal(BigDecimal("15"), BigDecimal("15").round)
    assert_equal(BigDecimal("20"), BigDecimal("15").round(-1))
    assert_equal(BigDecimal("0"), BigDecimal("15").round(-2))
    assert_equal(BigDecimal("-10"), BigDecimal("-15").round(-1, BigDecimal::ROUND_CEILING))
    assert_equal(BigDecimal("10"), BigDecimal("15").round(-1, BigDecimal::ROUND_HALF_DOWN))
    assert_equal(BigDecimal("20"), BigDecimal("25").round(-1, BigDecimal::ROUND_HALF_EVEN))
    assert_equal(BigDecimal("15.99"), BigDecimal("15.993").round(2))

    assert_equal(BigDecimal("1"), BigDecimal("1.8").round(0, BigDecimal::ROUND_DOWN))
    assert_equal(BigDecimal("2"), BigDecimal("1.2").round(0, BigDecimal::ROUND_UP))
    assert_equal(BigDecimal("-1"), BigDecimal("-1.5").round(0, BigDecimal::ROUND_CEILING))
    assert_equal(BigDecimal("-2"), BigDecimal("-1.5").round(0, BigDecimal::ROUND_FLOOR))
    assert_equal(BigDecimal("-2"), BigDecimal("-1.5").round(0, BigDecimal::ROUND_FLOOR))
    assert_equal(BigDecimal("1"), BigDecimal("1.5").round(0, BigDecimal::ROUND_HALF_DOWN))
    assert_equal(BigDecimal("2"), BigDecimal("1.5").round(0, BigDecimal::ROUND_HALF_EVEN))
    assert_equal(BigDecimal("2"), BigDecimal("2.5").round(0, BigDecimal::ROUND_HALF_EVEN))
  end

  def test_big_decimal_power
    n = BigDecimal("10")
    assert_equal(n.power(0), BigDecimal("1"))
    assert_equal(n.power(1), n)
    assert_equal(n.power(2), BigDecimal("100"))
    assert_equal(n.power(-1), BigDecimal("0.1"))
    assert_raises(TypeError) { n.power(1.1) }
  end

  def test_big_decimal_mode
    # Accept valid arguments to #mode
    assert BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW)
    assert BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW,true)
    assert BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW,false)

    # Reject invalid arguments to #mode
    assert_raises(TypeError) { BigDecimal.mode(true) } # first argument must be a Fixnum
    assert_raises(TypeError) { BigDecimal.mode(BigDecimal::EXCEPTION_OVERFLOW, 1) } # second argument must be [true|false]
    assert_raises(TypeError) { BigDecimal.mode(512) } # first argument must be == 256, or return non-zero when AND-ed with 255

    # exception mode defaults to 0
    assert_equal 0, BigDecimal.mode(1) # value of first argument doesn't matter when retrieving the current exception mode, as long as it's a Fixnum <= 255

    # set and clear a single exception mode
    assert_equal BigDecimal::EXCEPTION_INFINITY, BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true)
    assert_equal 0, BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false)
    assert_equal BigDecimal::EXCEPTION_NaN, BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true)
    assert_equal 0, BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)

    # set a composition of exception modes separately, make sure the final result is the composited value
    BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, true)
    BigDecimal.mode(BigDecimal::EXCEPTION_NaN, true)
    assert_equal BigDecimal::EXCEPTION_INFINITY | BigDecimal::EXCEPTION_NaN, BigDecimal.mode(1)

    # reset the exception mode to 0 for the following tests
    BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY, false)
    BigDecimal.mode(BigDecimal::EXCEPTION_NaN, false)

    # set a composition of exception modes with one call and retrieve it using the retrieval idiom
    # note: this is to check compatibility with MRI, which currently sets only the last mode
    # it checks for
    BigDecimal.mode(BigDecimal::EXCEPTION_INFINITY | BigDecimal::EXCEPTION_NaN, true)
    assert_equal BigDecimal::EXCEPTION_NaN, BigDecimal.mode(1)

    # rounding mode defaults to BigDecimal::ROUND_HALF_UP
    assert_equal BigDecimal::ROUND_HALF_UP, BigDecimal.mode(BigDecimal::ROUND_MODE)

    # make sure each setting complete replaces any previous setting
    [BigDecimal::ROUND_UP, BigDecimal::ROUND_DOWN, BigDecimal::ROUND_CEILING, BigDecimal::ROUND_FLOOR,
     BigDecimal::ROUND_HALF_UP, BigDecimal::ROUND_HALF_DOWN, BigDecimal::ROUND_HALF_EVEN].each do |mode|
    	assert_equal mode, BigDecimal.mode(BigDecimal::ROUND_MODE, mode)
    end

    # reset rounding mode to 0 for following tests
    BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_UP)

    assert_raises(TypeError) { BigDecimal.mode(BigDecimal::ROUND_MODE, true) } # second argument must be a Fixnum
    assert_raises(TypeError) { BigDecimal.mode(BigDecimal::ROUND_MODE, 8) } # any Fixnum >= 8 should trigger this error, as the valid rounding modes are currently [0..6]
  end

  def test_marshaling
    f = 123.456
    bd = BigDecimal.new(f.to_s)
    bd_serialized = Marshal.dump(bd)
    assert_equal f, Marshal.restore(bd_serialized).to_f
  end

  #JRUBY-2272
  def test_marshal_regression
    assert_equal BigDecimal('0.0'), Marshal.load(Marshal.dump(BigDecimal.new('0.0')))
  end
end


text:
package com.example.stitcher;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertNotNull;

import com.google.api.gax.rpc.NotFoundException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class UpdateSlateTest {

  private static final String LOCATION = "us-central1";
  private static final String SLATE_ID = TestUtils.getSlateId();
  private static final String SLATE_URI =
      "https://storage.googleapis.com/cloud-samples-data/media/ForBiggerEscapes.mp4";
  private static final String UPDATED_SLATE_URI =
      "https://storage.googleapis.com/cloud-samples-data/media/ForBiggerJoyrides.mp4";
  private static String PROJECT_ID;
  private static String SLATE_NAME;
  private static PrintStream originalOut;
  private ByteArrayOutputStream bout;

  private static String requireEnvVar(String varName) {
    String varValue = System.getenv(varName);
    assertNotNull(
        String.format("Environment variable '%s' is required to perform these tests.", varName));
    return varValue;
  }

  @BeforeClass
  public static void checkRequirements() {
    requireEnvVar("GOOGLE_APPLICATION_CREDENTIALS");
    PROJECT_ID = requireEnvVar("GOOGLE_CLOUD_PROJECT");
  }

  @Before
  public void beforeTest() throws IOException {
    TestUtils.cleanStaleSlates(PROJECT_ID, LOCATION);
    originalOut = System.out;
    bout = new ByteArrayOutputStream();
    System.setOut(new PrintStream(bout));

    SLATE_NAME =
        String.format("projects/%s/locations/%s/slates/%s", PROJECT_ID, LOCATION, SLATE_ID);
    try {
      DeleteSlate.deleteSlate(PROJECT_ID, LOCATION, SLATE_ID);
    } catch (NotFoundException e) {
      // Don't worry if the slate doesn't already exist.
    }
    CreateSlate.createSlate(PROJECT_ID, LOCATION, SLATE_ID, SLATE_URI);
    bout.reset();
  }

  @Test
  public void test_UpdateSlate() throws IOException {
    UpdateSlate.updateSlate(PROJECT_ID, LOCATION, SLATE_ID, UPDATED_SLATE_URI);
    String output = bout.toString();
    assertThat(output, containsString(SLATE_NAME));
    bout.reset();
  }

  @After
  public void tearDown() throws IOException {
    DeleteSlate.deleteSlate(PROJECT_ID, LOCATION, SLATE_ID);
    System.setOut(originalOut);
    bout.reset();
  }
}


text:
require "socket"
require "ipaddr"

module Cinch
  module DCC
    module Incoming
      # DCC SEND is a protocol for transferring files, usually found
      # in IRC. While the handshake, i.e. the details of the file
      # transfer, are transferred over IRC, the actual file transfer
      # happens directly between two clients. As such it doesn't put
      # stress on the IRC server.
      #
      # When someone tries to send a file to the bot, the `:dcc_send`
      # event will be triggered, in which the DCC request can be
      # inspected and optionally accepted.
      #
      # The event handler receives the plain message object as well as
      # an instance of this class. That instance contains information
      # about {#filename the suggested file name} (in a sanitized way)
      # and allows for checking the origin.
      #
      # It is advised to reject transfers that seem to originate from
      # a {#from_private_ip? private IP} or {#from_localhost? the
      # local IP itself} unless that is expected. Otherwise, specially
      # crafted requests could cause the bot to connect to internal
      # services.
      #
      # Finally, the file transfer can be {#accept accepted} and
      # written to any object that implements a `#<<` method, which
      # includes File objects as well as plain strings.
      #
      # @example Saving a transfer to a temporary file
      #   require "tempfile"
      #
      #   listen_to :dcc_send, method: :incoming_dcc
      #   def incoming_dcc(m, dcc)
      #     if dcc.from_private_ip? || dcc.from_localhost?
      #       @bot.loggers.debug "Not accepting potentially dangerous file transfer"
      #       return
      #     end
      #
      #     t = Tempfile.new(dcc.filename)
      #     dcc.accept(t)
      #     t.close
      #   end
      #
      # @attr_reader filename
      class Send
        # @private
        PRIVATE_NETS = [IPAddr.new("fc00::/7"),
                        IPAddr.new("10.0.0.0/8"),
                        IPAddr.new("172.16.0.0/12"),
                        IPAddr.new("192.168.0.0/16")]

        # @private
        LOCAL_NETS = [IPAddr.new("127.0.0.0/8"),
                      IPAddr.new("::1/128")]

        # @return [User]
        attr_reader :user

        # @return [Integer]
        attr_reader :size

        # @return [String]
        attr_reader :ip

        # @return [Fixnum]
        attr_reader :port

        # @param [Hash] opts
        # @option opts [User] user
        # @option opts [String] filename
        # @option opts [Integer] size
        # @option opts [String] ip
        # @option opts [Fixnum] port
        # @api private
        def initialize(opts)
          @user, @filename, @size, @ip, @port = opts.values_at(:user, :filename, :size, :ip, :port)
        end

        # @return [String] The basename of the file name, with
        #   (back)slashes removed.
        def filename
          File.basename(File.expand_path(@filename)).delete("/\\")
        end

        # This method is used for accepting a DCC SEND offer. It
        # expects an object to save the result to (usually an instance
        # of IO or String).
        #
        # @param [#<<] io The object to write the data to.
        # @return [Boolean] True if the transfer finished
        #   successfully, false otherwise.
        # @note This method blocks.
        # @example Saving to a file
        #   f = File.open("/tmp/foo", "w")
        #   dcc.accept(f)
        #   f.close
        #
        # @example Saving to a string
        #   s = ""
        #   dcc.accept(s)
        def accept(io)
          socket = TCPSocket.new(@ip, @port)
          total = 0

          while buf = socket.readpartial(8192)
            total += buf.bytesize

            begin
              socket.write_nonblock [total].pack("N")
            rescue Errno::EWOULDBLOCK, Errno::AGAIN
              # Nobody cares about ACKs, really. And if the sender
              # couldn't receive it at this point, they probably don't
              # care, either.
            end
            io << buf

            # Break here in case the sender doesn't close the
            # connection on the final ACK.
            break if total == @size
          end

          socket.close
          return true
        rescue EOFError
          return false
        end

        # @return [Boolean] True if the DCC originates from a private ip
        # @see #from_localhost?
        def from_private_ip?
          ip   = IPAddr.new(@ip)
          PRIVATE_NETS.any? {|n| n.include?(ip)}
        end

        # @return [Boolean] True if the DCC originates from localhost
        # @see #from_private_ip?
        def from_localhost?
          ip   = IPAddr.new(@ip)
          LOCAL_NETS.any? {|n| n.include?(ip)}
        end
      end
    end
  end
end


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

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
SingleLineComment (PMD 4.2.6 API)
</TITLE>

<META NAME="date" CONTENT="2011-09-14">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

net.sourceforge.pmd.ast

Class SingleLineComment

java.lang.Object
  net.sourceforge.pmd.ast.Comment
      net.sourceforge.pmd.ast.SingleLineComment

public class SingleLineComment
extends Comment

Constructor Summary

SingleLineComment(Token t)

Method Summary

Methods inherited from class net.sourceforge.pmd.ast.Comment

getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

SingleLineComment

public SingleLineComment(Token t)

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2011 InfoEther. All Rights Reserved.


text:
using System.ComponentModel;

namespace LinqAn.Google.Dimensions
{
	/// <summary>
	/// 	ID of the related product.
	/// </summary>
	[Description("ID of the related product.")]
	public class RelatedProductId: Dimension
	{
		/// <summary>
		/// 	Instantiates a <seealso cref="RelatedProductId" />.
		/// </summary>
		public RelatedProductId(): base("Related Product ID",false,"ga:relatedProductId")
		{

		}
	}
}


text:
using Chinchilla.Configuration;
using Chinchilla.Topologies;
using Chinchilla.Topologies.Model;
using Machine.Fakes;
using Machine.Specifications;

namespace Chinchilla.Specifications
{
    [Subject(typeof(PublisherFactory))]
    public class PublisherFactorySpecification : WithSubject<PublisherFactory>
    {
        static IPublisherConfiguration<TestMessage> configuration;

        static IModelReference reference;

        static IPublisher<TestMessage> publisher;

        Establish context = () =>
        {
            reference = An<IModelReference>();
            configuration = An<IPublisherConfiguration<TestMessage>>();

            configuration.WhenToldTo(c => c.BuildRouter()).Return(An<IRouter>());
            configuration.WhenToldTo(c => c.BuildTopology(Param.IsAny<IEndpoint>()))
                .Return(new MessageTopology { PublishExchange = An<IExchange>() });

            The<IMessageSerializers>().WhenToldTo(s => s.FindOrDefault(Param.IsAny<string>()))
                .Return(An<IMessageSerializer>());
        };

        class when_building_publisher
        {
            Because of = () =>
                Subject.Create(reference, configuration);

            It should_build_router = () =>
                configuration.WasToldTo(c => c.BuildRouter());

            It should_build_fault_strategy = () =>
                configuration.WasToldTo(c => c.BuildFaultStrategy());
        }

        class when_building_publisher_with_confirms
        {
            Establish context = () =>
                configuration.WhenToldTo(c => c.ShouldConfirm).Return(true);

            Because of = () =>
                publisher = Subject.Create<TestMessage>(reference, configuration);

            It should_create_confirming_publisher = () =>
                publisher.ShouldBeAssignableTo<ConfirmingPublisher<TestMessage>>();

        }

        class when_disposing_of_publisher
        {
            Because of = () =>
                Subject.Create(reference, configuration).Dispose();

            It should_not_be_tracking_publishers = () =>
                Subject.Tracked.ShouldBeEmpty();
        }

        public class TestMessage { }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Mycol. Mem. 9: 269 (1985)

#### Original name
Dichomyces fumosus Thaxt.

### Remarks
null


text:
@implementation UIColor (Night)

+ (NSArray *)arrayFromColor:(UIColor *)fromColor
                    ToColor:(UIColor *)toColor
                   duration:(NSTimeInterval)duration
               stepDuration:(NSTimeInterval)stepDuration
{
    if (!fromColor || !toColor) {
        return nil;
    }

    UIColor *tempColor = fromColor;
    NSUInteger steps = duration / stepDuration;

    CGFloat fromRed, fromGreen, fromBlue, fromAlpha;
    CGFloat toRed, toGreen, toBlue, toAlpha;

    [tempColor getRed:&fromRed green:&fromGreen blue:&fromBlue alpha:&fromAlpha];
    [toColor getRed:&toRed green:&toGreen blue:&toBlue alpha:&toAlpha];

    CGFloat diffRed = toRed - fromRed;
    CGFloat diffGreen = toGreen - fromGreen;
    CGFloat diffBlue = toBlue - fromBlue;
    CGFloat diffAlpha = toAlpha - fromAlpha;

    NSMutableArray *colorArray = [NSMutableArray array];

    [colorArray addObject:tempColor];

    for (NSUInteger i = 0; i < steps - 1; ++i) {
        CGFloat red = fromRed + diffRed / steps * (i + 1);
        CGFloat green = fromGreen + diffGreen / steps * (i + 1);
        CGFloat blue = fromBlue + diffBlue / steps * (i + 1);
        CGFloat alpha = fromAlpha + diffAlpha / steps * (i + 1);

        UIColor *color = [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
        [colorArray addObject:color];
    }

    [colorArray addObject:toColor];
    return colorArray;
}

@end


text:
typedef enum {
    WebNavigationTypePlugInRequest = WebNavigationTypeOther + 1
} WebExtraNavigationType;

@interface FUWindowController ()
- (void)handleCommandClick:(FUActivation *)act URL:(NSString *)s;
@end

#if RECORDING_ENABLED
@interface FUTabController (ScriptingPrivate)
- (void)script_loadURL:(NSString *)s;

- (BOOL)shouldHandleRequest:(NSURLRequest *)inReq;

- (void)script_submitForm:(NSURLRequest *)req withWebActionInfo:(NSDictionary *)info;
- (NSString *)XPathForFormInWebActionInfo:(NSDictionary *)info;
@end
#endif

@implementation FUTabController (Recording)
#if RECORDING_ENABLED

#pragma mark -
#pragma mark Web Recording

+ (void)initialize {
    if ([FUTabController class] == self) {

        Method old = class_getInstanceMethod(self, @selector(loadURL:));
        Method new = class_getInstanceMethod(self, @selector(script_loadURL:));
        method_exchangeImplementations(old, new);

    }
}

- (void)webView:(WebView *)wv decidePolicyForNavigationAction:(NSDictionary *)info request:(NSURLRequest *)req frame:(WebFrame *)frame decisionListener:(id <WebPolicyDecisionListener>)listener {
    if (![self shouldHandleRequest:req]) {
        [listener ignore];
        return;
    }

    WebNavigationType navType = [[info objectForKey:WebActionNavigationTypeKey] integerValue];

    if ([WebView _canHandleRequest:req]) {

        NSString *s = [[req URL] absoluteString];

        switch (navType) {
            case WebNavigationTypeOther:
            case WebNavigationTypeBackForward:
            case WebNavigationTypeReload:
                [listener use];
                break;
            case WebNavigationTypeLinkClicked:
            {
                FUActivation *act = [FUActivation activationFromWebActionInfo:info];
                if (act.isCommandKeyPressed) {
                    [listener ignore];
                    [windowController handleCommandClick:act URL:s];
                } else {
                    [listener ignore];
                    [self loadURL:s]; // send thru scripting
                }
            }
                break;
            case WebNavigationTypeFormSubmitted:
            case WebNavigationTypeFormResubmitted:
                if (submittingFromScript) {
                    submittingFromScript = NO;
                    [listener use];
                } else {
                    [listener use];
                    [self script_submitForm:req withWebActionInfo:info];
                }
                break;
            default:
                break;
        }

    } else if (WebNavigationTypePlugInRequest == navType) {
        [listener use];
    } else {
        // A file URL shouldn't fall through to here, but if it did, it would be a security risk to open it.
        if (![[req URL] isFileURL]) {
            [[NSWorkspace sharedWorkspace] openURL:[req URL]];
        }
        [listener ignore];
    }
}

- (void)script_loadURL:(NSString *)s {
    NSAppleEventDescriptor *aevt = [NSAppleEventDescriptor appleEventWithFluidiumEventID:'Load'];
    NSAppleEventDescriptor *tcDesc = [[self objectSpecifier] descriptor];
    [aevt setDescriptor:[NSAppleEventDescriptor descriptorWithString:s] forKeyword:keyDirectObject];
    [aevt setParamDescriptor:tcDesc forKeyword:'tPrm'];
    [aevt sendToOwnProcessNoReply];
}

- (void)script_submitForm:(NSURLRequest *)req withWebActionInfo:(NSDictionary *)info {
    NSAppleEventDescriptor *aevt = [NSAppleEventDescriptor appleEventWithFluidiumEventID:'Sbmt'];

    NSString *xpath = [self XPathForFormInWebActionInfo:info];
    if ([xpath length]) {
        [aevt setParamDescriptor:[NSAppleEventDescriptor descriptorWithString:xpath] forKeyword:'XPth'];
    }

    NSDictionary *formValues = [req formValues];
    if ([formValues count]) {
        NSAppleEventDescriptor *formValuesDesc = [NSAppleEventDescriptor descriptorWithDictionary:formValues];
        [aevt setParamDescriptor:formValuesDesc forKeyword:'Vals'];
    }

    NSAppleEventDescriptor *tcDesc = [[self objectSpecifier] descriptor];
    [aevt setParamDescriptor:tcDesc forKeyword:'tPrm'];

    [aevt sendToOwnProcessNoReply];
}

- (NSString *)XPathForFormInWebActionInfo:(NSDictionary *)info {
    DOMHTMLFormElement *formEl = [info objectForKey:@"WebActionFormKey"];
    if (!formEl) {
        return nil;
    }

    DOMHTMLCollection *forms = [(DOMHTMLDocument *)[webView mainFrameDocument] forms];

    NSInteger formIndex = -1;

    NSInteger i = 0;
    NSInteger len = [forms length];
    for ( ; i < len; i++) {
        DOMNode *el = [forms item:i];
        if (el == formEl) {
            formIndex = i;
            break;
        }
    }

    NSAssert(formIndex > -1, @"");
    NSString *xpath = [NSString stringWithFormat:@"(//form)[%d]", formIndex];
    return xpath;
}

#endif
@end