This file contains hidden or 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 handlePhoneInput (evt) { | |
var inpt = evt.target, | |
op; | |
if (inpt.value.length > prev_inpt.length) { | |
op = 'typed'; | |
} | |
else if (inpt.value.length < prev_inpt.length) { | |
op = 'deleted'; | |
} |
This file contains hidden or 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
for i in $(ls ~/wherevs/*.png); do | |
if [ ! $(echo $i | ack whatevs) ]; then | |
rm -P $i | |
fi | |
done |
This file contains hidden or 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 commaify (num) { | |
var num_string, | |
i, | |
len, | |
threes = [], | |
remainders; | |
num_string = num.toString(); | |
len = num_string.length; | |
remainders = len % 3; |
This file contains hidden or 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 mobilechromedebug () { | |
previous_directory="$(pwd)" | |
cd /path/to/platform-tools/goes/here/ | |
./adb forward tcp:9222 localabstract:chrome_devtools_remote | |
open -a "/Applications/Google\ Chrome.app" http://localhost:9222 | |
cd $previous_directory | |
} |
This file contains hidden or 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
s/}/\ | |
}\ | |
\ | |
/g | |
s/{/ {\ | |
/g | |
s/;/;\ | |
/g |
This file contains hidden or 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 convertToOrdinal (i, zero_based) { | |
var number = zero_based ? ((i - 0) + 1) : (i - 0), // bootleg coercion | |
one = /\d+1$/, | |
two = /\d+2$/, | |
three = /\d+3$/, | |
zero_and_four_through_nine = /\d+[0456789]$/; | |
// For whatever goofy reason, typeof NaN == 'number' | |
if (typeof number == 'number' && !isNaN(number)) { | |
if (number == 0) { |