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
// Check if a web page sniffs the user agent or not. | |
var page = require('webpage').create(), | |
sniffing, address; | |
page.onInitialized = function () { | |
page.evaluate(function () { | |
window.originalNavigator = window.navigator; |
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
/* raw and ugly */ | |
@-webkit-keyframes anim { | |
0% { -webkit-transform: translate3d(0px, 0px, 0px); } | |
100% { -webkit-transform: translate3d(150px, 0px, 0px) } } | |
/* formatted using http://senchalabs.github.com/cssbeautify */ | |
@-webkit-keyframes anim { | |
0% { | |
-webkit-transform: translate3d(0px, 0px, 0px); | |
} |
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 = new WebPage(), | |
address; | |
// Let's see what the web page's console might output. | |
page.onConsoleMessage = function (msg) { | |
console.log('from web page: ' + msg); | |
}; | |
// Hijack assignment to window.onload to do nothing. | |
page.onInitialized = 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
<html> | |
<head></head> | |
<shoulder></shoulder> | |
<knees></knees> | |
<toes></toes> | |
</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
<html> | |
<head></head> | |
<shoulder></shoulder> | |
<knees></kneeds> | |
<toes></toes> | |
</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
// Modify global object at the page initialization. | |
// In this example, effectively Math.random() always returns 0.42. | |
var page = new WebPage(); | |
page.onInitialized = function () { | |
page.evaluate(function () { | |
Math.random = function() { | |
return 42 / 100; | |
}; |
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
Increase the goat teleporter timeout threshold to 100 because the old | |
value of 10 caused problems for extremely overweight goats. Tests show | |
that the largest goat in existence should be teleported in 50ms, so... | |
BUG=31337,2754 | |
TEST=Try loading an overweight goat and confirm the teleporter works. |
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
All resources: | |
[ | |
{ | |
"method": "GET", | |
"url": "http://m.bing.com/", | |
"time": 1 | |
}, | |
{ | |
"method": "GET", | |
"url": "http://m.bing.com/css/1/V1/common.css", |
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 = new WebPage(), address, resources = []; | |
if (phantom.args.length === 0) { | |
console.log('Usage: netsniff.js <some URL>'); | |
phantom.exit(); | |
} else { | |
address = phantom.args[0]; | |
page.onLoadStarted = function () { | |
page.startTime = Date.now(); |
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 = new WebPage(); | |
page.onConsoleMessage = function (msg) { | |
console.log(msg); | |
}; | |
page.open('http://www.google.com/m/local?site=local&q=pizza+in+new+york', function (status) { | |
if (status !== 'success') { | |
console.log('Unable to access network'); | |
} else { |