Copyright (c) 2011 Jed Schmidt
a small module for auto-importing modules in node.js.
require( "./autorequire" )
require.auto( <module-name> )
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 |
Traceback (most recent call last): | |
File "flickrtouchr/flickrtouchr.py", line 368, in <module> | |
inodes[photoid] = getphoto(imgurl, target) | |
File "flickrtouchr/flickrtouchr.py", line 170, in getphoto | |
fh = open(filename, "w") | |
IOError: [Errno 2] No such file or directory: u"japan '09/20091002220101-3975078266_o-vanilla ice cream w/ coffee @ sushi sen, nishi azabu.jpg" |
// objective: a function for generating guids of unique entities | |
// usage: guid( obj ) => integer | |
// approach 1 | |
// entities kept in a hash array, key id found by iteration | |
// pros: | |
// (1) unobtrusive; doesn't pollute objects with expandos | |
// (2) ids can't be accidentally deleted/changed | |
// (3) ids can be assigned to any type of object |
var guid = { | |
// uses an expando to store the id on the object | |
// wicked fast, but not reliable without DOM hackery (see jQuery source) | |
"expando": function( last ) { | |
return function guid( obj ) { | |
if ( obj ) { | |
if ( obj.guid ) return obj.guid | |
obj.guid = last | |
Checking for program g++ or c++ : /usr/bin/g++ | |
Checking for program cpp : /usr/bin/cpp | |
Checking for program ar : /usr/bin/ar | |
Checking for program ranlib : /usr/bin/ranlib | |
Checking for g++ : ok | |
Checking for program gcc or cc : /usr/bin/gcc | |
Checking for gcc : ok | |
Traceback (most recent call last): | |
File "/Users/jed/desktop/node/tools/waf-light", line 158, in <module> | |
Scripting.prepare(t, cwd, VERSION, wafdir) |
var domReady = !document.readyState && document.addEventListener | |
? function( fn ){ document.addEventListener( "domContentLoaded", fn ) } | |
: function( fn ){ setTimeout( /in/( document.readyState ) ? function(){ domReady( fn ) }, 50 ) : fn ) } |
curl -N localhost:8080 |
var http = require( "http" ) | |
, url = require( "url" ) | |
, exec = require( "child_process" ).exec | |
, username = process.argv[ 2 ] | |
, seconds = +process.argv[ 3 ] || 300 | |
, friends | |
, events = {} | |
if ( !username ) { |