Skip to content

Instantly share code, notes, and snippets.

@mikelehen
mikelehen / timestamped-console-log.js
Created April 16, 2013 19:06
Wraps console.log to include a timestamp (in seconds since the wrapper was initialized) with every log message.
console.log = (function() {
var console_log = console.log;
var timeStart = new Date().getTime();
return function() {
var delta = new Date().getTime() - timeStart;
var args = [];
args.push((delta / 1000).toFixed(2) + ':');
for(var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
@mikelehen
mikelehen / prune-firepad-history.js
Created April 10, 2013 19:37
Prune history of a Firepad.
// This should be easier, but due to an oversight in the checkpoint id's, it's a tad tricky (you need this revision/id stuff).
// I'll rework things to be cleaner in the near future.
function pruneHistory(firepadRef) {
var characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
function revisionToId(revision) {
if (revision === 0) {
return 'A0';
}