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
/* | |
* Sugar for type detection working across frames and browsers ;) | |
* | |
* Detected types | |
* | |
* 'arguments', 'array', 'boolean', 'date', 'document', 'element', 'error', 'fragment', | |
* 'function', 'nodelist', 'null', 'number', 'object', 'regexp', 'string', 'textnode', | |
* 'undefined', 'window' | |
* | |
* Copyright (c) 2009 Daniel Steigerwald (http://daniel.steigerwald.cz), Mit Style License |
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
test('My First Test', [ | |
on('GET /test').return('{"result":"something"', {status:200,SetCookie:"abcdefgh..."}).parse('$id',/^xxx/), | |
on('GET /lorem/$id').return('{"result":"something"', {status:200,SetCookie:"abcdefgh..."}) | |
]); | |
suite('TestGrid self-hoist suite', [ | |
test('create new test suite', | |
on('POST /suites', |
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
// install: npm install zombie sqlite3 | |
require.paths.unshift('./node_modules'); | |
var repl = require('repl'); | |
var cli = repl.start(); | |
var tt = { | |
from: "Praha", | |
to: "Brno", | |
date: "14.4.2011", |
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 http = require('http'), EventEmitter = require('events').EventEmitter; | |
var cache = {}; | |
http.createServer(function (req, res) { | |
var key = someMagic(req), cached = cache[key]; // get some unique request identifier | |
if (!cached) { // if we've never seen this request before | |
cached = new EventEmitter(); // make this cache entry an event emitter | |
cached.status = 'running'; | |
handleAsyncRequest(function(result) { // your request handling is probably asynchronous, call this callback when you're done |
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
###* | |
@fileoverview Songs view refactored. | |
Why such refactoring? | |
To separate logic and wiring. | |
Then we can test things with logic without wiring mess. | |
### | |
goog.provide 'app.songs.View' | |
goog.require 'goog.ui.Component' |
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 http = require('http'); | |
// This works! | |
http.get({ | |
host: 'www.google.com', | |
port: 80, | |
path: '/' | |
}, function(res) { console.error("First result",res.statusCode); }); | |
// This doesn't! |
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
.DS_Store | |
tmp/**/* |
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
// This is a testcase for a suspected bug in node.js | |
// server doesn't fire close/end events if the connection was closed in the response before request finished sending data | |
var http = require('http'), util = require('util'), PORT = 8080; | |
// sample HTTP server | |
// responds immediately and closes response | |
var s = http.createServer(function(req, res) { | |
req.on('close', function() { return console.error('!!!REQUEST CLOSED'); }); | |
req.on('end', function() { return console.error('!!!REQUEST ENDED'); }); |