Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin Freitag justinfreitag-zz

  • Melbourne, Australia
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am justinfreitag on github.
  • I am justinfreitag (https://keybase.io/justinfreitag) on keybase.
  • I have a public key whose fingerprint is F779 C5C1 D5A8 1583 A3FE 897C 35E1 A730 9F69 2E40

To claim this, I am signing this object:

@justinfreitag-zz
justinfreitag-zz / gist:7295068
Created Nov 3, 2013
1 second buckets, makes use of redis active list expiry.
View gist:7295068
var Redis = require('redis'),
toArray = require('../lib/to-array');
var bucketSpan = 10,
redis = Redis.createClient(),
zeroTimeKey = 'message:history:0:time';
function getBucketId(timestamp) {
timestamp = Math.floor(timestamp / 1000);
if (timestamp >= (zeroTime + bucketSpan)) {
View gist:2957964
coco = require \coco
vm = require \vm
export evaluate = (code, options = {}) ->
return unless code = code.trim!
Script = vm.Script
if Script
if options.sandbox?
if options.sandbox instanceof Script.createContext!.constructor
sandbox = options.sandbox
View ex.coffee
caffienateMethod = (server, name) ->
originalName = '_' + name
server[originalName] = server[name]
server[name] = (route, callback) ->
server[originalName] route, (request, response, next, param) ->
@[route] = param unless not param?
[@request, @header, @query, @params, @body] = [request, request.header, \
request.query, request.params, request.body]
@response = response
@json = (object, args...) -> @response.json object, args
You can’t perform that action at this time.