Skip to content

Instantly share code, notes, and snippets.

Avatar

Jed Schmidt jed

View GitHub Profile
View client.js
var http = require( "http" )
, puts = require( "sys" ).puts
, str = "?token=xxx&apiKey=xxx"
, request = http
.createClient( 80, "rpxnow.com", true )
.request( "POST", "/api/v2/auth_info", {
host: "rpxnow.com",
"content-length": str.length
});
View fabml.js
// just an idea for now
with( fab = require( "fab" ) )
with( fab.html )
module.exports = fab
()
( /^\// )
View require_example.js
with ( require( "fab" ) )
( fab )
( require )
( "html" )
( "nodejs" )
( "googleAnalytics" )
()
( globalize, html )
View heroku_demo.js
fab = require( "fab" );
appCount = 79353;
with ( fab )
( fab )
( import, html )
( listen, 0xFAB )
( route, /^\/$/ )
View url_misparse.js
require("url").parse("//google.com");
// { href: '//google.com'
// , pathname: '//google.com'
// }
View argSnifferSmackdown.js
var max = 1000000
, fn = function fn(a,b,c,d,e){}
, jedTime
, higginsTime
, t = new Date;
for ( var i = max; i--; ) schmidt( fn );
jedTime = new Date - t;
t = new Date;
@jed
jed / clever_vs_clearer.js
Created Oct 27, 2010
is this code worth the 5 byte savings?
View clever_vs_clearer.js
{1:"createElement",2:"createAttribute",3:"createTextNode",8:"createComment",11:"createDocumentFragment"}
",Element,Attribute,TextNode,,,,,Comment,,,DocumentFragment".replace(/\b\w/g,"create$&").split(",")
@jed
jed / invert.js
Created Oct 27, 2010
each, extend, and map in one function
View invert.js
function invert( index, fn ) {
var key = index.length, val
if ( key > 0 ) while ( key-- ) this[ val = index[ key ] ] = fn ? fn( val, key ) : key
else for ( key in index ) this[ val = index[ key ] ] = fn ? fn( val, key ) : key
return this
}