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 add_pr_remotes() { | |
mv .git/config .git/config-orig | |
awk '/remote "origin"/ { | |
print $0 | |
getline; | |
print $0 | |
getline; | |
print $0 | |
print "\tfetch = +refs/pull/*/head:refs/remotes/origin/pr/*" |
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
#!/usr/bin/env bash | |
# relies on OS X's version of `open` | |
open "http://github.com/$(git remote -v | head -1 | sed -E 's/.*[email protected]:(.*)\.git.*/\1/')" |
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
// promise definition | |
var Promise = function() { | |
this.successCallbacks = []; | |
this.errorCallbacks = []; | |
}; | |
Promise.prototype.then = function(successCallback, errorCallback) { | |
console.log('then()'); | |
this.successCallbacks.push(successCallback); |
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 shim */ | |
(function() { | |
var f = function() {}; | |
if (!window.console) { | |
window.console = { | |
log: f, info: f, warn: f, debug: f, error: f | |
}; | |
} | |
}()); |
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 countCSSRules() { | |
var results = '', | |
log = ''; | |
if (!document.styleSheets) { | |
return; | |
} | |
for (var i = 0; i < document.styleSheets.length; i++) { | |
countSheet(document.styleSheets[i]); |