Skip to content

Instantly share code, notes, and snippets.

@abrkn
Created November 10, 2012 22:10
Show Gist options
  • Save abrkn/4052715 to your computer and use it in GitHub Desktop.
Save abrkn/4052715 to your computer and use it in GitHub Desktop.
module.exports = function(scale) {
var last = null, repeat = 0;
scale || (scale = 2);
return function() {
var now = +new Date;
if (now == last) {
repeat++;
} else {
repeat = 0;
last = now;
}
return last * Math.pow(10, scale) + repeat;
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment