Skip to content

Instantly share code, notes, and snippets.

View cloudhead's full-sized avatar
🌴
On vacation

Alexis Sellier cloudhead

🌴
On vacation
View GitHub Profile
/*
A simple new-line delimited JSON protocol with upgrades.
Receiving Usage:
protocol = require('./frame-protocol');
// parsing data
parser = protocol.Parser();
// Based on http://bit.ly/215MBZ
function FailureDetector(ws) {
// ws stands for window size.
// How many heartbeat intervals we keep track of.
this.ws = ws || 100;
this.window = [];
this.last = null;
}
exports.FailureDetector = FailureDetector;
@ThisIsMissEm
ThisIsMissEm / gist:242732
Created November 25, 2009 14:18
A very basic daemon for Node.js
#! /bin/sh
CUR_DIR=$PWD
PID_FILE="$CUR_DIR/node.pid"
if [ $1 = "start" ]; then
if [ -e $PID_FILE ]; then
echo "Node.js is already running."
else
echo "Starting Node Server"