This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery.fn.cacheOf - By Jed Schmidt (MIT Licensed) | |
// A lightweight jQuery memoizer for caching the results of expensive DOM operations. | |
// Example usage: | |
// Say you have a processing-intensive call | |
// that occurs often in your code. | |
$().find( "*:not(:contains(abc))" ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tmpl-node.js: a template module for node.js | |
// Jed Schmidt - http://jedschmidt.com/ | |
// | |
// inspired by John Resig's micro templates | |
// http://ejohn.org/blog/javascript-micro-templating/ | |
var posix = require( "posix" ), | |
concat = Array.prototype.concat; | |
process.mixin( exports, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.Promise.prototype.combine = function() { | |
var args = Array.prototype.slice.call( arguments ), | |
count = args.length, | |
results = new Array( count ), | |
index = 0, | |
self = this; | |
if ( count == 1 && args[0] instanceof Array ) | |
return arguments.callee.apply( self, args[0] ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* adapted by Jed Schmidt for use as a node.js module. | |
* the following node.js adapter code is MIT-licensed. | |
* | |
* Example usage: | |
* | |
* var sha1 = require("sha1.js"), hash; | |
* | |
* my_sha1 = sha1.hex( data ); | |
* my_hmac_sha1 = sha1.hex( key, data ); | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* adapted by Jed Schmidt for use as a node.js module */ | |
this.encode = base64encode; | |
this.decode = base64decode; | |
this.chars = function( string ) { | |
base64EncodeChars = string || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | |
base64DecodeChars = []; | |
for ( var i = 128; i--; ) { | |
if ( base64DecodeChars[ i ] === undefined ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gist-in-time can style | |
your github gists and make them | |
much less obtrusive. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function cloneFn( fn ) { | |
var | |
str = fn.toString(), | |
args = str.match( /\((.*)\)/ )[1].split(/\W+/), | |
body = str.match( /{((?:.|\n)+)}/ )[1]; | |
return Function.apply( this, args.concat( body ) ); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Dispatcher() { | |
var signatures = [], functions = []; | |
function fn() { | |
var | |
args = arguments, | |
argNo, | |
arity = args.length, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
captures = this.pathname.match( | |
new RegExp( "^(.*)(" + captures.join(")(.*)(") + ")(.*)$" ) | |
).slice( 1 ); | |
captures[ pos * 2 + 1 ] = val; | |
this.pathname = captures.join(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node-bench | |
var list = [ | |
"foo", | |
"bar", | |
"baz", | |
"quux", | |
"asdf", | |
"qwerty", |
OlderNewer