Skip to content

Instantly share code, notes, and snippets.


Tom Medema tommedema

View GitHub Profile
View gist:2693589
#runs the working directory unit tests
NODE_ENV=test \
mocha --ignore-leaks $(shell find ./test -name \*test.js)
#deploys working directory
make test
make deploy-git
tommedema / fileIterator.js
Created May 13, 2012 — forked from Raynos/0usage.js
Iterate all the files
View fileIterator.js
var fs = require("fs"),
path = require("path");
function iterateFiles(uri, callback, done, fileRegexp) {
var counter = 1
fs.readdir(uri, errorProxy(done, readFiles))
function readFiles(err, files) {
counter += files.length
View gist:2661961
status=$(git status --porcelain)
test "x$(status)" != "x"
View gist:2661323
var EventEmitter2 = require('eventemitter2').EventEmitter2,
should = require('should'),
request = require('request'),
config = require('../../src/config');
describe('server', function() {
var mediator,
port = config.server.port;
View gist:2661090
var EventEmitter2 = require('eventemitter2').EventEmitter2,
should = require('should');
describe('server', function() {
var mediator;
beforeEach(function() {
mediator = new EventEmitter2({
View gist:2660821
var mediator;
beforeEach(function() {
mediator = new EventEmitter2({wildcard: false});
View gist:2660716
var mediator = new EventEmitter2({wildcard: false});
mediator.once('boot.ready', function() {
mediator.once('boot.ready', function() {
View gist:2654772
var EventEmitter2 = require('eventemitter2').EventEmitter2,
should = require('should');
describe('server', function() {
var mediator = new EventEmitter2({
wildcard: false
View gist:2634104
module.exports = function(mediator) {
.on('boot.init', function() {
console.log('boot init phase, outputting process information:');
console.log('process argv: %j', process.argv);
console.log('process execPath: %s', process.execPath);
console.log('process working dir: %s', process.cwd());
console.log('process gid: %d', process.getgid());
console.log('process uid: %d', process.getuid());
View gist:2630097

All application logic is defined using routines. Routines are loaded on runtime and are passed a global event emitter instance, called the mediator.

##Example The following describes an application example structure.

Application objective: create a http server and serve a RESTful API (serves current music stations and the current songs for each station).

###File tree

  • src/ (contains source files)
  • bootstrap.js (initializes the application and loads routines)