Skip to content

Instantly share code, notes, and snippets.

@emk
emk / rerun.sh
Created December 3, 2010 21:53
Rerun a command automatically whenever files in a directory change
#!/bin/bash
#
# Usage: find . -name \*.hs | rerun make
#
# Install inotifywait using 'sudo apt-get install inotify-tools' or whatever.
#
# Automatically re-run a command when a file changes. Assumes that your
# text editor closes files after each write. Pipe file names on standard
# input.
@emk
emk / comet_client.coffee
Created September 19, 2010 03:39
Real-time Comet with Faye, Node.js and Coffee
# Client-side Comet code. See comet_server.coffee for instructions.
client = new Faye.Client '/faye', timeout: 90
# Attach a security key to all our subscription messages.
client.addExtension
outgoing: (msg, callback) ->
return callback(msg) unless msg.channel is '/meta/subscribe'
(msg.ext ?= {}).authToken = 'secret'
callback(msg)