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 | |
var sys = require("sys"), | |
fs = require("fs"), | |
chat = require('../lib/server'), | |
router = require("../lib/router"); | |
// create chat server | |
var chatServer = chat.createServer(); | |
chatServer.listen(8001); |
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
vows.describe('format.js library').addVows({ | |
"Number formatting": { | |
// run this once, and execute the following tests when it completes | |
topic: 42, | |
"is the number":function(n){ | |
assert.equal(n,42); | |
} | |
} | |
}); |
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 (exports) { | |
// because the anonymous function is being called without a scope being set, | |
// "this" will refer to the global scope. In a browser, that's the window, but | |
// will be "undefined" in strict mode. In other JS platforms, it may be some | |
// other thing. | |
// my code here. | |
// don't make accidental globals. | |
// hang a small number of things on the "exports" object. |
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
UBER FILE | |
----------------- | |
.something { | |
!click-a | |
} | |
input#search { | |
:hover { ... } | |
!click-b | |
} |
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
input ! click { | |
delay: 1ms; | |
} | |
! fadeOut { | |
time: 100ms; | |
} | |
input#search ! tokenize { | |
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
input ! click { | |
delay: 1ms; | |
} | |
! fadeOut { | |
time: 100ms; | |
} | |
input#search ! tokenize { | |
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
// | |
// Recursively traverse a hierarchy, returning | |
// a list of all relevant .js files. | |
// | |
function paths(dir) { | |
var paths = []; | |
try { fs.statSync(dir) } | |
catch (e) { return [] } |
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
var fs = require("fs") | |
, path = require("path") | |
fs.tree = function (root, cb) { | |
fs.lstat(root, function (er, s) { | |
if (er) return cb(er) | |
s.name = root | |
// if it's a dir, then get the list of children. | |
if (!s.isDirectory()) return cb(null, s) | |
fs.readdir(root, function (er, children) { |
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
var http = require("http"), | |
querystring = require("querystring"), | |
sys = require("sys"); | |
var channel = "http://chat.nodejitsu.com/chat", | |
speed = 5000, | |
spammers = 10; | |
for (var i = 0; i < spammers; i++ ) { | |
setTimeout(startSpamming, (speed / spammers) * i); |
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
var sys = require('sys'); | |
var child_process = require('child_process'); | |
var servers = ['host1', 'host2', 'host3']; | |
var i; | |
for ( i in servers ) { | |
var server = servers[i]; | |
sys.puts('init: ' + server); |