Skip to content

Instantly share code, notes, and snippets.

View jed's full-sized avatar

Jed Schmidt jed

View GitHub Profile
fab = require( "fab" );
appCount = 79353;
with ( fab )
( fab )
( import, html )
( listen, 0xFAB )
( route, /^\/$/ )
require("url").parse("//google.com");
// { href: '//google.com'
// , pathname: '//google.com'
// }
()
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;
/* Configuration header created by Waf - do not edit */
#ifndef _CONFIG_H_WAF
#define _CONFIG_H_WAF
#define HAVE_SSL_LIBRARY_INIT 1
#define HAVE_OPENSSL_CRYPTO_H 1
#define HAVE_CONFIG_H 1
#endif /* _CONFIG_H_WAF */
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* fdatasync(2) is available */
/* #undef HAVE_FDATASYNC */
/* futimes(2) is available */
@jed
jed / clever_vs_clearer.js
Created October 27, 2010 08:29
is this code worth the 5 byte savings?
{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 October 27, 2010 08:41
each, extend, and map in one function
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
}
@jed
jed / userAgentJavascriptTest.js
Created October 28, 2010 12:12
send different content based on sideloaded javascript
var urls = {}
require( "http" ).createServer( function( req, res ) {
var url = req.url, timeout
if ( url == "/favicon.ico" ) return res.writeHead( 404 ), res.end()
if ( url in urls ) return urls[ url ]( req, res )
url = "/vapor.js?" + Math.floor( Math.random() * 0xcfd41b9100000 ).toString( 36 )
> jedbook:desktop jed$ node /usr/local/lib/node/.npm/socket.io/0.6.1/package/exale/server.js
1 Dec 22:06:12 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This might slow down initial connections slightly.
1 Dec 22:06:12 - socket.io ready - accepting connections
1 Dec 22:07:11 - Initializing client with transport "websocket"
1 Dec 22:07:11 - Client 8948545621242374 connected
1 Dec 22:07:11 - Client 8948545621242374 disconnected
1 Dec 22:07:16 - Initializing client with transport "xhr-polling"
1 Dec 22:07:16 - Client 2304718098603189 connected
1 Dec 22:07:47 - Initializing client with transport "websocket"
1 Dec 22:07:47 - Client 7040154365822673 connected