Skip to content

Instantly share code, notes, and snippets.

@gjohnson
Created December 15, 2012 20:06
Show Gist options
  • Save gjohnson/4298762 to your computer and use it in GitHub Desktop.
Save gjohnson/4298762 to your computer and use it in GitHub Desktop.
ideas for the api
// http://amix.dk/blog/post/19714#bitmapist-Powerful-realtime-analytics-with-Redis-2-6s-bitmaps-and
var bitcrunch = require('bitcrunch')
, client = bitcrunch.connect();
// mark user 123 as active and has played a song:
client.mark('active', 123, fn);
client.mark('song:played', 123, fn);
// timebased queries
var active = client.monthly('active', new Date);
var played = client.monthly('song:played', new Date);
// count the active users/players
active.count(fn);
played.count(fn);
// bit operations w/ composition
active
.and(played)
.count(fn);
active
.or(played)
.count(fn);
@gjohnson
Copy link
Author

Finally got around to this if your interested in tinkering... do you happen to know of a decent, minimal command-queue / promise-like module for handling sequential chaining?

https://github.com/gjohnson/bitcrunch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment