Skip to content

Instantly share code, notes, and snippets.

@searls
Created November 7, 2011 15:30
Show Gist options
  • Save searls/1345281 to your computer and use it in GitHub Desktop.
Save searls/1345281 to your computer and use it in GitHub Desktop.
window.blog = function(msg) {
lines.push({time: new Date(), message: msg});
$(function() {
var $flash = $('#flash-warning').css('font-family','Courier New').show().find('.message');
$flash.html('<a class="blah">reset</a> <a class="flush">flush</a><br/>'+_(lines).reduce(function(m,l) {
return m+'['+l.time+'] '+l.message+'<br/>';
},''));
});
};
$('.blah').live('click',function(e) { e.preventDefault(); lines = []; $('#flash-warning .message').html(''); });
$('.flush').live('click',function(e) { e.preventDefault(); blog(JSON.stringify(model.toJSON())); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment