This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
try { | |
var $_console$$ = console; | |
Object.defineProperty(window, "console", { | |
get: function() { | |
if ($_console$$._commandLineAPI) | |
throw "Sorry, for security reasons, the script console is deactivated on this website"; | |
return $_console$$ | |
}, | |
set: function($val$$) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("___Digest Time") | |
angular.element(document).injector().invoke(function($rootScope) { var a = performance.now(); $rootScope.$apply(); console.log(performance.now()-a); }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript: (function() {var a = document.createElement("script");a.src = "https://rawgithub.com/kentcdodds/ng-stats/master/dist/ng-stats.js";a.onload=function(){window.showAngularStats()};document.head.appendChild(a)})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on answer to question | |
// http://stackoverflow.com/questions/4391575/how-to-find-the-size-of-localstorage | |
(function showLocalStorageSize() { | |
function stringSizeBytes(str) { | |
return str.length * 2; | |
} | |
function toMB(bytes) { | |
return bytes / 1024 / 1024; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from https://www.youtube.com/watch?v=S9sktFzL3tQ | |
(function timeFirstPaint() { | |
/* global chrome */ | |
var fp = chrome.loadTimes().firstPaintTime - chrome.loadTimes().startLoadTime; | |
console.log('first paint: ' + fp); | |
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Timing.js 1.0.4 | |
* Copyright 2015 Addy Osmani | |
*/ | |
(function(window) { | |
'use strict'; | |
/** | |
* Navigation Timing API helpers | |
* timing.getTimes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Finds total size of objects attached to the scopes | |
(function ngScopeSize() { | |
var i, data, scope, | |
count = 0, | |
all = document.all, | |
len = all.length, | |
test = {}, | |
scopes = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Namespace creation method | |
function setNamespace (ns_string, ns) { | |
var parts = ns_string.split('.'), | |
parent = ns; | |
if (parts[0] === "App") { | |
parts = parts.slice(1); | |
} | |
var pl = parts.length; | |
for (var i = 0; i < pl; i++) { | |
//create a property if it doesnt exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function useStableChromeVersion { | |
curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb; | |
sudo dpkg -i google-chrome.deb; | |
sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome; | |
rm google-chrome.deb | |
} | |
useStableChromeVersion |
OlderNewer