Skip to content

Instantly share code, notes, and snippets.

@brycebaril
Created October 4, 2013 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brycebaril/8fd794f99aba05d67398 to your computer and use it in GitHub Desktop.
Save brycebaril/8fd794f99aba05d67398 to your computer and use it in GitHub Desktop.
var microtime = require("microtime-x");
var db = require("level-version")(require("uberlevel")("./x.app"), {defaultVersion: microtime});
var dhash = function () {
return ((new Date).getFullYear()).toString() + ~~((Date.now() - (new Date((new Date).getFullYear(), 0, 0))) / 86400000)
}, push = function ( plain, cb ) {
db.put(dhash(), plain, cb && cb);
}, read = function ( dh, cb, end ) {
db.createVersionStream(dh).on("data", cb).on("end", end)
}
setInterval(function () {
push( "kenansulayman:Hey!" );
push( "brycebaril:Yo!" );
}, 500)
setTimeout(function () {
read(dhash(), console.log, process.exit.bind(process));
}, 10E3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment