This script is also available at .
This file contains 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 executeEventQueue() { | |
eventEmitter.emit(LISTENERS.executeApplicationEvents); | |
process.nextTick(executeEventQueue); | |
} | |
executeEventQueue(); |
This file contains 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
var log = require('log'); | |
/** | |
* | |
* @returns | |
*/ | |
module.exports = { | |
server: { | |
address: '10.138.188.67', | |
port: 8000, |
This file contains 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 bench (lmbd) { | |
var i = 0, | |
start = new Date().getTime() | |
while (i!=10000) { | |
lmbd() | |
++i | |
} | |
return new Date().getTime() - start | |
} |
This file contains 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
var assert = require('assert'), | |
EventEmitter = require('events').EventEmitter, | |
myEventEmitter = new EventEmitter() | |
var A = function(){} | |
// Create a Test Suite | |
module.exports = { | |
'when the topic is a regular object': function (assert) { | |
var a = new A(); |
This file contains 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
var functions_array = []; | |
for (var i = 1; i < 4; i++) { | |
(function(index) { | |
functions_array[index] = function() { | |
var data = index; | |
sys.puts(data); | |
}; | |
})(i); | |
}; |
This file contains 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
var sys = require('sys'), | |
http = require('http'), | |
ws = require("./vendor/ws"), | |
arrays = require('./vendor/arrays'); | |
var headers = {}; | |
headers['Host'] = "search.twitter.com"; | |
var clients = []; |
This file contains 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
fetch = -> | |
Git.readFile version, Path.join('articles', "#{name}.markdown"), preprocess | |
preprocess = (err, markdown) -> | |
return finish err if err | |
props = preProcessMarkdown markdown | |
finish Data.author version, props.author if props.author | |
finish {} | |
finish = (err, author) -> |
This file contains 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
var POOLSIZE = 8*1024; | |
var pool; | |
function allocPool () { | |
pool = new Buffer(POOLSIZE); | |
pool.used = 0; | |
} | |
function FastBuffer (subject, encoding, legacy, slice_legacy) { | |
var length, type; |
This file contains 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
class Planet | |
constructor: (@name,@size,@x,@y) -> | |
@ships = {} | |
@damage_pool = {} | |
add_ships: (player,amount) -> | |
#add ships to an array based on the player who owns them | |
log("adding #{amount} ships to player #{player}") | |
if @ships[player]? | |
@ships[player] += amount |
NewerOlder