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
if (phantom.state.length === 0) { | |
phantom.state = 'pizza'; | |
phantom.open('http://www.google.com/m/local?site=local&q=pizza+nyc'); | |
} else { | |
var list = document.querySelectorAll('div.bf'); | |
for (var i in list) { | |
console.log(list[i].innerText); | |
} | |
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
var cb = function (data) { | |
var loc = data.city; | |
if (data.region_name.length > 0) | |
loc = loc + ', ' + data.region_name; | |
console.log('IP address: ' + data.ip); | |
console.log('Estimated location: ' + loc); | |
phantom.exit(); | |
}; | |
var el = document.createElement('script'); |
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
scope.ready(function(my, $) { | |
$('button').on('click', function() { | |
my('box').setText('Hello World from my.js!') | |
.addClass('message') | |
.setLeft(200, {duration: 300}); | |
}); | |
}); |
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 panels = p || this.panels, | |
rounds = r || this.rounds, | |
rotationPerPanel = 360/panels, | |
rotationPerRound = 360/2/rounds, | |
yRotation, xRotation, | |
width = this.panelWidth, | |
zTranslate = (width/2) / Math.tan(rotationPerPanel * Math.PI/180), | |
$container = this.el, | |
$ul, $li, i, j; |
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
$.script(['mod1.js', 'mod2.js'], 'base', function () { | |
// script is ready | |
}); | |
// event driven. listen for 'base' files to load | |
$.script.ready('base', function () { | |
}); | |
$('p').animate({ | |
opacity: 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
var block_clicks = function() { | |
var isBlocked = !blockClick; | |
blockClick = false; | |
return isBlocked; | |
}; | |
// The lightbox function first does: | |
e = e || event; | |
if (e.ctrlKey || e.shiftKey || | |
(e.which && (e.which === 2 || e.which === 3)) || |
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
Edge::add = (nick, name, complete) { | |
@client.select 15 | |
user = User.find! {id: nick} | |
puzzle = Puzzle.find! {name: name} | |
err, data = client.set! "u:#{user}:p:#{puzzle}" | |
complete() | |
} |
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
/* Keyfram-licious animation */ | |
@-webkit-keyframes colors { | |
0% {background-color: #39f;} | |
15% {background-color: #F246C9;} | |
30% {background-color: #4453F2;} | |
45% {background-color: #44F262;} | |
60% {background-color: #F257D4;} | |
75% {background-color: #EDF255;} | |
90% {background-color: #F20006;} | |
100% {background-color: #39f;} |
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
amb_run(function(amb, fail){ | |
/* <preamble> */ | |
// utility function to test if two strings are adjacent | |
function adjacent(str1, str2) { | |
return str1.charAt(str1.length - 1) == str2.charAt(0); | |
} | |
// input data | |
var w1 = amb([ "the", "that", "a" ]); | |
var w2 = amb([ "frog", "elephant", "thing" ]); | |
var w3 = amb([ "walked", "treaded", "grows" ]); |
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 file = jDataView.createBuffer( | |
0x10, 0x01, 0x00, 0x00, // Int32 - 272 | |
0x90, 0xcf, 0x1b, 0x47, // Float32 - 39887.5625 | |
0, 0, 0, 0, 0, 0, 0, 0, // 8 blank bytes | |
0x4d, 0x44, 0x32, 0x30, // String - MD20 | |
0x61 // Char - a | |
); | |
// Now we use the DataView as defined in the specification, the only thing that changes is the j before jDataView. |