Skip to content

Instantly share code, notes, and snippets.

@soldair
Created May 16, 2014 00:53
Show Gist options
  • Save soldair/c8bdb394c18b34ad7dd6 to your computer and use it in GitHub Desktop.
Save soldair/c8bdb394c18b34ad7dd6 to your computer and use it in GitHub Desktop.
requirebin sketch
var bs = require('binary-search');
console.log(bs);
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({f7tKFK:[function(require,module,exports){module.exports=function(haystack,needle,comparator,low,high){var mid,cmp;if(low===undefined)low=0;else{low=low|0;if(low<0||low>=haystack.length)throw new RangeError("invalid lower bound")}if(high===undefined)high=haystack.length-1;else{high=high|0;if(high<low||high>=haystack.length)throw new RangeError("invalid upper bound")}while(low<=high){mid=low+(high-low>>1);cmp=+comparator(haystack[mid],needle);if(cmp<0)low=mid+1;else if(cmp>0)high=mid-1;else return mid}return~low}},{}],"binary-search":[function(require,module,exports){module.exports=require("f7tKFK")},{}]},{},[]);var bs=require("binary-search");console.log(bs);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"binary-search": "1.2.0"
}
}
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment