Function.prototype.bind from the Prototype library.
Similar to call
and apply
but allows you to return a reference to a function that is called in a particular context instead of executing it immediately. Also allows you to curry parameters. It's so useful that it became a part of ECMAScript 5 and is already being implemented natively in browsers.
Function.prototype.bind = function() {
var __method = this, args = Array.prototype.slice.call(arguments), object = args.shift();
return function() {
var local_args = args.concat(Array.prototype.slice.call(arguments));
if (this !== window) local_args.push(this);
return __method.apply(object, local_args);
}
}