I hereby claim:
- I am afshin on github.
- I am darian (https://keybase.io/darian) on keybase.
- I have a public key whose fingerprint is 62C6 231F F6A4 31F8 57B9 29B6 4B0E 7F36 237A CAFC
To claim this, I am signing this object:
Array.prototype.search = function (x, l, h, m) { | |
//returns an index >= 0 if arr.search(x) is found | |
//returns a negative index if arr.search(x) is not found | |
//if arr.search(x) < 0, Math.floor(-1 * arr.search(x)) is how many items in arr are smaller than x | |
return arguments.length < 4 ? this.search(x, 0, this.length - 1, Math.floor((this.length - 1) / 2)) | |
: h < l ? l === 0 ? -0.1 : -1 * l | |
: this[m] < x ? this.search(x, m + 1, h, m + 1 + Math.floor((h - (m + 1)) / 2)) | |
: this[m] > x ? this.search(x, l, m - 1, l + Math.floor((m - 1 - l) / 2)) | |
: m; | |
}; |
(function () { | |
var has = 'hasOwnProperty', slice = Array.prototype.slice; | |
Function.prototype.partial = function () { | |
var method = this, orig = arguments, orig_len = orig.length, key, | |
new_method = function () { | |
var arguments_len = arguments.length, args = [], i = 0, j = 0; | |
if (!arguments_len) return method.apply(this, slice.call(orig)); | |
for (; i < orig_len; i++) | |
args.push(orig[i] === void 0 ? arguments[j++] : orig[i]); | |
return method.apply(this, args.concat(slice.call(arguments, j, arguments_len))); |
Function.prototype.partial = function () { | |
var fn = this, args = Array.prototype.slice.call(arguments); | |
return function () { | |
var arg = 0; | |
for (var i = 0; i < args.length && arg < arguments.length; i++) | |
if (args[i] === undefined) | |
args[i] = arguments[arg++]; | |
return fn.apply(this, args); | |
}; | |
}; |
(function () { | |
var delay = setTimeout.partial(undefined, 10); | |
delay(function () { | |
console.log('A call to this function will be temporarily delayed.'); | |
}); | |
// logs 'A call to this function will be temporarily delayed.' | |
})(); |
(function () { | |
var delay = setTimeout.partial(undefined, 10); | |
delay(function () { | |
console.log('A call to this function will be temporarily delayed.'); | |
}); | |
// logs 'A call to this function will be temporarily delayed.' | |
delay(function () {console.log('Some other message.');}); | |
// logs 'A call to this function will be temporarily delayed.' | |
})(); |
(function () { | |
var delay = setTimeout.partial(undefined, 10); | |
delay(function () { | |
console.log('A call to this function will be temporarily delayed.'); | |
}); | |
// logs 'A call to this function will be temporarily delayed.' | |
delay(function () {console.log('Some other message.');}); | |
// logs 'Some other message.' | |
})(); |
I hereby claim:
To claim this, I am signing this object:
package main | |
import ( | |
"flag" | |
"fmt" | |
"github.com/zeromq/gyre" | |
"os" | |
"time" | |
) |
This is just a gist. |