Skip to content

Instantly share code, notes, and snippets.

@erikakers
Created October 1, 2013 22:52
Show Gist options
  • Save erikakers/6786505 to your computer and use it in GitHub Desktop.
Save erikakers/6786505 to your computer and use it in GitHub Desktop.
Javascript: Local Development App Debug
if ( location.hostname.indexOf('localhost') !== -1 ) {
App.debug = true;
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://localhost:35729/livereload.js';
head.appendChild(script);
}
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
log.history.push(arguments);
if ( this.console ) {
console.log( Array.prototype.slice.call(arguments) );
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment