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 observer = new MutationObserver(function(mutations) { | |
//console.log('OBSERVED', mutations); | |
var observation = parseInt(Math.random() * 100); | |
console.group('Observation ' + observation); | |
mutations.forEach(function(mutation) { | |
console.log('%s: %s', mutation.target.nodeName, mutation.type, mutation); | |
}); | |
console.groupEnd(); | |
}); | |
var config = {childList: true, attributes: true, characterData: true, subtree: true, attributeOldValue: true, characterDataOldValue: true}; |
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.js app under nginx | |
upstream node { | |
server 127.0.0.1:8001; | |
} | |
server { | |
listen 80; | |
server_name node; |
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'), | |
form = require('connect-form'), | |
fs = require('fs'), | |
util = require('util'); | |
var app = express.createServer( | |
form({keepExtensions: true}) | |
); | |
// switch between development and production like this: |
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
#!/bin/bash | |
# nodejs - Startup script for node.js server | |
# chkconfig: 35 85 15 | |
# description: node is an event-based web server. | |
# processname: node | |
# server: /path/to/your/node/file.js | |
# pidfile: /var/run/nodejs.pid | |
# |
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
#! /bin/sh | |
# ------------------------------------------------------------------------------ | |
# SOME INFOS : fairly standard (debian) init script. | |
# Note that node doesn't create a PID file (hence --make-pidfile) | |
# has to be run in the background (hence --background) | |
# and NOT as root (hence --chuid) | |
# | |
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
# INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
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
// Expose modules in ./support for demo purposes | |
require.paths.unshift(__dirname + '/../../support'); | |
/** | |
* Module dependencies. | |
*/ | |
var express = require('../../lib/express') | |
, form = require('connect-form'); |
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
// Expose modules in ./support for demo purposes | |
require.paths.unshift(__dirname + '/../../support'); | |
/** | |
* Module dependencies. | |
*/ | |
var express = require('../../lib/express') | |
, form = require('connect-form'); |
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
#! /bin/sh | |
# ------------------------------------------------------------------------------ | |
# SOME INFOS : fairly standard (debian) init script. | |
# Note that node doesn't create a PID file (hence --make-pidfile) | |
# has to be run in the background (hence --background) | |
# and NOT as root (hence --chuid) | |
# | |
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
# INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
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'), | |
faye = require('faye'), | |
fs = require('fs'), | |
path = require('path'); | |
var bayeux = new faye.NodeAdapter({ | |
mount: '/faye', | |
timeout: 45 | |
}); |
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 Controller = require(GO.paths.controller); | |
GO.aop = require(GO.paths.vendor + '/aop'); | |
GO.time = require(GO.paths.vendor + '/bm'); | |
var Application = function(app) { | |
app.get('*', function(req, res, next) { | |
var ctrl = new Controller(req, res, next); | |
// GO.Socket.emit('data', 'custom2: ' + GO.utils.uid(10)); |