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 withReturn = function() { | |
return 'x'; | |
}; | |
var withoutReturn = function() { | |
'x'; | |
}; | |
JSLitmus.test('without a return', function() { | |
for (var i=0; i<1000; 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 http = require('http'); | |
http.createServer(function (req, res) { | |
res.writeHead(200, {'Content-Type': 'application/json'}); | |
res.write('{"json":'); | |
if (Math.random() < 0.1) { | |
// ?? | |
} | |
res.write('"here"}'); | |
res.end(); |
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
class Test | |
redraw: => | |
for x in y | |
$('body').click => | |
@widgify(x) |
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
router.post('/save'). | |
bind (req, res, next) -> | |
buffer: null | |
req.addListener 'data', (chunk) -> | |
if buffer | |
temp_buffer: new Buffer buffer.length + chunk.length | |
buffer.copy temp_buffer, 0, 0 | |
chunk.copy temp_buffer, buffer.length, 0 | |
buffer: temp_buffer |
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
router.post('/save'). | |
bind (req, res, next) -> | |
body: new Buffer(parseInt(req.headers['content-length'])) | |
offset: 0 | |
req.addListener 'data', (chunk) -> | |
length: chunk.length | |
chunk.copy(body, offset, 0, length) | |
offset += length |
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 Route = function(){.....} | |
Route.prototype.toString = function() { | |
return "hihi"; | |
} | |
global.bob = { | |
route: (new Route) | |
} |
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
Router: require 'biggie-router' | |
router: new Router() | |
router.get(/.*\.(css|js)$/).module 'gzip' | |
router.module 'static', './public' | |
router.bind (req, res, next) -> | |
res.sendBody 404, "File not found" |
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
require.paths.unshift('lib'); | |
require('express'); | |
require('express/plugins'); | |
redisclient = require('redis-node-client/lib/redis-client'); | |
Parallel = require('parallel').Parallel; | |
redis = redisclient.createClient(); | |
sys = require('sys'); | |
configure(function () { | |
use(Logger); |
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
require.paths.unshift('lib'); | |
require('express'); | |
require('express/plugins'); | |
redisclient = require('redis-node-client/lib/redis-client'); | |
redis = redisclient.createClient(); | |
sys = require('sys'); | |
configure(function () { | |
use(Logger); |
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
asyncFunction: (x, y, z) ~> | |
yield | |
readFirstFile: (dir, ~, error) ~> | |
[err, files]: fs.readdir dir, ~ | |
return error(err) if err | |
[err, out]: fs.readFile files[o], ~ | |
return error(err) if err | |
yield content |