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
// in Sublime Text, Preferences -> Browse Packages, find HTML-CSS-JS Prettify/scripts/node_modules/js-beautify/js/lib/beautify.js | |
// find the last line of the 'beautify' function, and place the next lines just before 'return sweet_code'; | |
// https://gist.github.com/loopmode/d091bce3b76efaf15d63 | |
// es7 decorators | |
sweet_code = sweet_code.replace(/@\n/g, '@'); | |
sweet_code = sweet_code.replace(/\)@\s/g, ')\n@'); | |
sweet_code = sweet_code.replace(/ @ /g, ' @'); | |
sweet_code = sweet_code.replace(/@\s/g, '\n@'); | |
sweet_code = sweet_code.replace(/\];@/g, '];\n@'); |
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
# Add the alias below to ~/.bash_profile on a Mac | |
# Save the file and run: source ~/.bash_profile | |
alias code='open $@ -a "Visual Studio Code"' |
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
angular.module('stateMock',[]); | |
angular.module('stateMock').service("$state", function($q){ | |
this.expectedTransitions = []; | |
this.transitionTo = function(stateName){ | |
if(this.expectedTransitions.length > 0){ | |
var expectedState = this.expectedTransitions.shift(); | |
if(expectedState !== stateName){ | |
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName ); | |
} | |
}else{ |
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() { | |
console.group( 'Performance Information for all entries of ' + window.location.href ); | |
console.log( '\n-> Duration is displayed in ms\n ' ) | |
var entries = window.performance.getEntries(); | |
entries = entries.sort( function( a, b ) { | |
return b.duration - a.duration; | |
} ); | |
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
<ul> | |
<li ng-repeat="item in items | orderObjectBy:'color':true">{{ item.color }}</li> | |
</ul> |
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
global | |
daemon | |
defaults | |
mode http | |
timeout connect 86400000 | |
timeout server 86400000 | |
timeout client 86400000 | |
timeout check 5s |
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
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |