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 this example, myNumber could be 0-99 | |
myNumber = 7; | |
paddedNumber = ('0' + myNumber).slice(-2); |
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
# Large-ish (480x360) with letterboxing | |
http://img.youtube.com/vi/9bZkp7q19f0/0.jpg | |
# Tiny (120x90) letterboxed - Early in video | |
http://img.youtube.com/vi/9bZkp7q19f0/1.jpg | |
# Tiny (120x90) letterboxed - Midway through video | |
http://img.youtube.com/vi/9bZkp7q19f0/2.jpg | |
# Tiny (120x90) letterboxed - Late in video |
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
// http://stackoverflow.com/a/6021027 | |
function updateQueryStringParameter(uri, key, value) { | |
var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i"); | |
var separator = uri.indexOf('?') !== -1 ? "&" : "?"; | |
if (uri.match(re)) { | |
return uri.replace(re, '$1' + key + "=" + value + '$2'); | |
} else { | |
return uri + separator + key + "=" + value; | |
} | |
} |
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
http://www.facebook.com/feeds/page.php?format=json&id=166106021034 |
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
git archive --format zip --output ~/Desktop/project-name.zip master |
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 page = require('webpage').create(); | |
page.settings.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36'; | |
page.viewportSize = { width: 1200, height: 1200 }; | |
page.clipRect = { top: 0, left: 0, width: 1200, height: 1200 }; | |
page.open('http://jamie3d.com/', function () { | |
page.render('output.png'); | |
phantom.exit(); | |
}); |
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
const PHANTOM_FUNCTION_PREFIX = '/* PHANTOM_FUNCTION */'; | |
var page = require('webpage').create(); | |
page.onConsoleMessage = function(msg) { | |
if (msg.indexOf(PHANTOM_FUNCTION_PREFIX) === 0) { | |
eval('(' + msg + ')()'); | |
} else { | |
console.log(msg); | |
} |
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/phantomjs examples/netsniff.js "http://www.amazon.com" > amazon.com.har |
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 | |
for URL in $(cut -d, -f2 < url_list.txt) | |
do | |
URL=$(sed -e 's/^http\(\|s\):\/\///g' <<< "$URL" ) | |
echo $URL | |
done |