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 parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/' | |
} | |
function check_git_changes { | |
var=`git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l` | |
if [ $var -ne 1 ]; then | |
tput setaf 1 # red | |
else | |
tput setaf 2 # green | |
fi |
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 foo = [1,2,3]; | |
for(var i = 0; i < foo.length; i++){ | |
(function(el, i){ | |
})(foo[i], i, foo); | |
} | |
my.each = function(ar, fn, obj){ | |
for(var i = 0; i < ar.length; i++){ | |
fn.apply(obj || window, ar[i], i, ar); |
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
// sorta like manual profiling. | |
// peek into your jquery method calls to see why they are being called so much | |
// usage: | |
// $.logCallsTo('append'); | |
// $.logCallsTo('curCSS',true); | |
// output: | |
// http://gyazo.com/40cec25d875a7a767e95fd7a2f451b32.png |
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/sh | |
# setup ------------------------------------------------------------------------ | |
tempDir="/tmp/`whoami`/chrome-nightly/"; | |
baseURL="http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/"; | |
baseName="chrome-mac"; | |
baseExt="zip"; | |
appName="Chromium.app"; | |
appDir="/Applications"; | |
version=~/.CURRENT_CHROME; |
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
//EnhanceJS isIE test idea | |
//detect IE and version number through injected conditional comments (no UA detect, no need for cond. compilation / jscript check) | |
//version arg is for IE version (optional) | |
//comparison arg supports 'lte', 'gte', etc (optional) | |
var isIE = (function(){ | |
var doc = document, |
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
import urllib | |
print 'javascript:' + urllib.quote(""" | |
(function(){ | |
var e = document.createElement('script'); | |
e.src='/boot.js'; | |
e.type='text/javascript'; | |
document.getElementsByTagName('body')[0].appendChild(e);})() | |
""".strip().replace('\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
(function (undefined) { | |
function detectMutation() { | |
mutationSupported = true; | |
this.removeEventListener('DOMAttrModified', detectMutation, false); | |
} | |
var forEach = [].forEach, | |
regex = /^data-(.+)/, | |
el = document.createElement('div'), | |
mutationSupported = false, |
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
// mousewheel normalization. | |
// taken from http://html5readiness.com/js/script.js - cheers paul! | |
$(document).bind('DOMMouseScroll mousewheel', function(e, delta) { | |
delta = delta || (e.detail && -e.detail/3) || (e.wheelDelta && e.wheelDelta/120); | |
}); | |
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
// Idea from http://dbaron.org/log/20100424-any | |
jQuery.expr[':'].any = function(el, i, match) { | |
return jQuery.find.matches(match[3], [el]).length > 0; | |
}; | |
jQuery('body :any(div, form) p'); // Same as jQuery('body div p, body form p') | |
jQuery('div:any(.foo,.bar)'); // Same as jQuery('div.foo, div.bar') |
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
/* | |
* media.matchMedium()- test whether a CSS media type or media query applies | |
* primary author: Scott Jehl | |
* Copyright (c) 2010 Filament Group, Inc | |
* MIT license | |
* adapted by Paul Irish to use the matchMedium API | |
* http://www.w3.org/TR/cssom-view/#media | |
* Doesn't implement media.type as there's no way for crossbrowser property | |
* getters. instead of media.type == 'tv' just use media.matchMedium('tv') |
OlderNewer