Skip to content

Instantly share code, notes, and snippets.

View tim-smart's full-sized avatar

Tim tim-smart

View GitHub Profile
var withReturn = function() {
return 'x';
};
var withoutReturn = function() {
'x';
};
JSLitmus.test('without a return', function() {
for (var i=0; i<1000; i++) {
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();
class Test
redraw: =>
for x in y
$('body').click =>
@widgify(x)
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
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
var Route = function(){.....}
Route.prototype.toString = function() {
return "hihi";
}
global.bob = {
route: (new Route)
}
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"
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);
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);
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