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
for(i=0;i<100;++i){a="";!(i%3)&&(a+="fizz");!(i%5)&&(a+="buzz");console.log(a?a:i)} |
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 ctx = new window.webkitAudioContext(); | |
var processor = ctx.createJavaScriptNode(512, 2, 1); | |
var url = 'http://static1.kevincennis.com/sounds/callmemaybe.mp3'; | |
var audio = new Audio(url); | |
var micEnabled = false; | |
var songReady = false; | |
audio.addEventListener('canplaythrough', function() { | |
micEnabled && audio.play(); | |
songReady = true; |
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 domain = require('domain'); | |
domain.create().on('error', function(error) { | |
console.log(error); | |
}).run(foo); | |
function foo() { | |
// async call.. will throw an error | |
zap(); | |
} |
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
generateLineInfo = (x, y) -> | |
x: x | |
y: y | |
xVelocity: Math.random() * 20 * (if (~~(Math.random() * 2) == 1) then -1 else 1) | |
yVelocity: Math.random() * 10 * (if (~~(Math.random() * 2) == 1)then -1 else 1) | |
window.onload = () -> | |
width = window.innerWidth | |
height = window.innerHeight |
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
# within the router | |
initialize: () -> | |
@history = [] | |
@bind 'all', @routeChange | |
routeChange: -> | |
if @history[@history.length - 1] != Backbone.history.fragment | |
@history.push Backbone.history.fragment | |
if @history.length == 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
// port from your server | |
req.protocol + '://' + req.host + ( port == 80 || port == 443 ? '' : ':'+port ) + req.path; |
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
function operation(prop, val) { | |
if (val) { obj[prop] = val; } | |
else { obj[prop](); } | |
return operation; | |
} | |
// now you can do operation('foo', '1')('saySomething')('zap bar', '123') | |
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
require 'open3' | |
namespace :casper do | |
namespace :test do | |
task :start_jasmine_runner => :environment do | |
Open3.popen3("rails s -p 5555") | |
# TODO MAKE THIS NOT BE A SIMPLE WAIT | |
sleep 30 | |
puts "Rails + jasminerice started!" | |
end |
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
what did the lamp say to the table | |
nice legs | |
what is a brit's favorite game? | |
teaball | |
what is a royal cow called? | |
sir loin | |
how do you cure a pig? |