Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.