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') | |
, httpProxy = require('http-proxy'); | |
httpProxy.createServer(function (req, res, proxy) { | |
// | |
// Put your custom server logic here | |
// | |
proxy.proxyRequest(req, res, { | |
host: 'localhost', | |
port: 9000 |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 George Stagas https://github.com/stagas | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC 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
var dnode = require('dnode') | |
, express = require('express') | |
, app = express.createServer() | |
app.use(express.static(__dirname)) | |
app.listen(8080) | |
console.log('http://localhost:8080/') | |
var server = dnode(function(remote, conn) { | |
this.click = function() { |
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() { | |
var $body = $('body') | |
, $book = $('#book') | |
;(function animate_background() { | |
$body.animate({ backgroundColor: "#abcdef" }, 1000, function(){ | |
$body.animate({ backgroundColor: "#000" }, 1000, animate_background) | |
}) | |
}()) |
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
$(document).ready(function() { | |
var $book = $('#book') | |
// wrapping the function in a closure | |
;(function display_icon() { | |
$book.hide(1000, function() { | |
$book.show(1000, function() { | |
setTimeout(function() { | |
display_icon(); | |
}, 0); | |
}); |
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 express = require('express') | |
, app = express.createServer() | |
app.use(express.cookieParser()) | |
app.use(express.session({ secret: 'foo' })) | |
app.use(function(req, res, next) { | |
console.log(req.url, typeof req.session) | |
next() | |
}) |
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() { | |
var parse = JSON.parse | |
JSON.parse = function(s, f) { | |
var ISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/ | |
return parse(s, f ? f : function(key, value) { | |
return typeof value === 'string' | |
? ISO.exec(value) && new Date(value) || value | |
: value | |
}) | |
} |
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 dnode = require('dnode') | |
dnode({ | |
bar: function(cb) { | |
cb({ | |
foo: 'bar' | |
, date: new Date() | |
}) |
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 locals = {} | |
var err | |
do { | |
err = undefined | |
try { | |
with(locals) { | |
foo | |
bar |
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
$ node | |
> require('dnode') | |
WideCharToMultiByte: ▒ ▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒ ▒▒▒ ▒▒▒▒▒ ▒▒ ▒▒▒ ▒▒▒▒▒ ▒▒▒ ▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒. | |
{ [Function: dnode] connect: [Function], listen: [Function] } | |
> |