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
// The polling function | |
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
var checkCondition = function(resolve, reject) { | |
var ajax = fn(); | |
// dive into the ajax promise | |
ajax.then( function(response){ | |
// If the condition is met, we're done! |
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
#!/usr/cloudshark/ruby/bin/ruby | |
# | |
# | |
# EXAMPLE CAPTURE PRUNING SCRIPT | |
# | |
# This is example code which must be run AT YOUR OWN RISK | |
# CloudShark is not responsible for any unintended data loss. | |
# This script is not officially supported by CloudShark or QA Cafe. | |
# | |
require 'date' |
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
gem "json", "1.8.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
package scrabble_score | |
import "testing" | |
var tests = []struct { | |
input string | |
expected int | |
}{ | |
{"", 0}, | |
{" \t\n", 0}, |
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 type='text/javascript'> | |
var Search = <%= @search.to_json.gsub("/", "\/") %>; | |
</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
# big_array has over 120,000 strings in it | |
def select_search(q) | |
big_array.select do |s| | |
s =~ /^#{Regexp.esecap(q)}/ | |
end | |
end | |
def grep_search(q) | |
big_array.grep( /^#{Regexp.escape(q)}/ ) |