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
# lets you do echo 'lol' | todata | |
# or cat filename | todata | |
# and it'll spit out a nice data URI | |
todata() { | |
if [ ! -t 0 ]; then | |
php -r "echo 'data:text/plain;base64,'.base64_encode(file_get_contents('php://stdin')); }" && echo; | |
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
untiny() { | |
for U in $*; do | |
curl -I $U 2>/dev/null | grep ^Location | cut -d' ' -f2; | |
done; | |
} |
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
nuke() { | |
local prompt="?"; | |
until [[ "^[YyNn]" =~ "$prompt" ]]; do | |
echo -n "Are you really sure? (y/n) "; | |
read prompt; | |
done; | |
if [[ "^[Yy]" =~ "$prompt" ]]; then | |
prompt="?"; | |
until [[ "^[YyNn]" =~ "$prompt" ]]; do | |
echo -n "Like REALLY sure? (y/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
# find the most popular author with svn blame | |
svnauthor() { | |
local FILE; | |
local AUTH; | |
local PERCENT; | |
local BIGGEST; | |
local WRITTEN; | |
local TOTAL; | |
for FILE in $*; do | |
SVN_ST=$(svn st $FILE 2>&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
# reload this profile | |
reloadprofile() { | |
[ -x ~/.bash_profile ] && . ~/.bash_profile; | |
} | |
# edit this profile | |
editprofile() { | |
$EDITOR ~/.bash_profile; | |
} |
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
flab = | |
function () { | |
var s = Array.prototype.slice, | |
a = [s.call(arguments)], | |
b = function () { | |
b._calls = a | |
a.push(s.call(arguments)) | |
return b | |
} | |
b.toString = function () { |
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
<!doctype html> | |
<html> | |
<body> | |
<ol> | |
<li>Work at Yahoo!</li> | |
<li>???</li> | |
<li>PROFIT!!!</li> | |
</ol> | |
</body> | |
</html> |
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
// on http://www.w3.org/TR/CSS21/syndata.html | |
Array.prototype.forEach.call(document.querySelectorAll('span.colorsquare'), function(square) { | |
var name = square.childNodes[0].innerText, | |
hex = square.childNodes[1].data.trim(); | |
if (hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6]) { | |
hex = '#' + hex[1]+hex[3]+hex[5]; | |
} | |
if (hex.length > name.length) { | |
console.log(hex, '->', name); | |
} |
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
// on http://www.w3.org/TR/css3-color/ | |
Array.prototype.forEach.call(document.querySelectorAll('table.colortable')[1].querySelectorAll('td:not(.c)'), function(td) { | |
var name = td.innerText, | |
hex = td.nextSibling.innerText; | |
if (hex[1] === hex[2] && hex[3] === hex[4] && hex[5] === hex[6]) { | |
hex = '#' + hex[1]+hex[3]+hex[5]; | |
} | |
if (hex.length > name.length) { | |
console.log(hex, '->', name); | |
} |
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 | |
DIR=${1:-.}; | |
if [ -z "$YUI" -o ! -r "$YUI" ]; then | |
echo "You need the path to YUI Compressor as env var \$YUI"; | |
exit 1; | |
fi | |
for CSS in `find $DIR -type f -name *.css`; do |