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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js'></script> | |
<script> | |
$(document).ready(function(){ | |
function debug(str){ $("#debug").append("<p>"+str+"</p>"); }; | |
if(typeof WebSocket === 'undefined') { | |
alert("Your browser does not support websockets.") | |
} |
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
/** | |
* Render templates. | |
* | |
* @param {String} The template to use `<p>Hello {{name}}</p>` | |
* @param {String} The data `{ name: 'Alex' }` | |
* @return {String} The rendered template | |
**/ | |
function template(t, d) { | |
return t.replace(/{{([^}]*)}}/g, function(m, f, p, a) { | |
return d[f] || ''; |
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
Foo = {}; | |
Foo.bar = function(){ | |
alert("test"); | |
} | |
setTimeout(Foo.bar, 1000); // 1 second later, alert's "test" |
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
var results = new SearchResults(); | |
results.searchTerm = "some search term"; | |
results.fetch({ | |
success: someView.showTheResults | |
}); |
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
# teach stupid IE to embrace Array.indexOf | |
unless Array.indexOf | |
Array::indexOf = (item) -> | |
for i in [0..this.length-1] | |
return i if this[i] == item | |
return -1 |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'selenium-webdriver' | |
sauce_username = ENV['SAUCE_USERNAME'] || 'YOUR_SAUCE_USERNAME' | |
sauce_api_key = ENV['SAUCE_API_KEY'] || 'YOUR_SAUCE_API_KEY' | |
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer | |
caps.version = "7" |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'selenium-webdriver' | |
sauce_username = ENV['SAUCE_USERNAME'] || 'YOUR_SAUCE_USERNAME' | |
sauce_api_key = ENV['SAUCE_API_KEY'] || 'YOUR_SAUCE_API_KEY' | |
caps = Selenium::WebDriver::Remote::Capabilities.firefox | |
caps.version = "5" |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script class="jsbin" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<!--[if IE]> | |
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> | |
<![endif]--> | |
<style> |
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
// coderbyte.com intro challenge | |
function jsChallenge() { | |
var num = 0; | |
for(i=0; i<=1000; i++) { | |
if( !(isMultipleOfFive(i) || isMultipleOfSeven(i)) ) { | |
num += i; | |
} |
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
// http://coderbyte.com/CodingArea/Results.php?ct=Array%20Addition%20I | |
function ArrayAdditionI(arr) { | |
var sumEqualToMember = false; | |
var max = Math.max.apply({},arr); | |
for(i=0; i<=arr.length; i++) { | |
var sum = arr[i]; |
OlderNewer