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 'json' | |
require 'socket' | |
require 'timeout' | |
TIMEOUT = 2 | |
RSpec::Matchers.define :respond_with do |regexp| | |
match do |io| | |
begin | |
Timeout::timeout(TIMEOUT) { @message = io.readline } |
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/bin/env ruby | |
class String | |
def shuffle | |
chars.to_a.shuffle.join | |
end | |
end | |
me = File.basename __FILE__ | |
where_am_i = File.dirname __FILE__ |
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
#!/bin/sh | |
# | |
# YO DAWG I HERD U LIKE ORDER-DEPENDENT TESTS? | |
# | |
# SO I PUT ORDER-DEPENDENT EXAMPLES N UR ORDER-DEPENDENT SPECS | |
# SO U CAN B NON-DETERMINISTIC WHILE UR NON-DETERMINISTIC | |
# | |
# http://memegenerator.net/instance/11059517 | |
function die () { |
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
#!/bin/sh | |
# The most important line in any shell program. | |
# | |
# Sometimes, though, I wish it worked in the [shebang][]. | |
set -e | |
file="$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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'blinky' | |
l = Blinky.new.light | |
module Blinky | |
module GoCiServer | |
def get_server_locations |
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
Describe "Logging In" do | |
Context "Successful Login" do | |
before do | |
User.create(:username => "Scott", :password => "Tiger") | |
visit :login_page | |
on_page_with(:login_form) do |login_form| | |
login_form.login("Scott", "Tiger") | |
end | |
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
# | |
# The hair colors of Australian fashion models | |
# | |
import json | |
import re | |
import urllib.request | |
API = 'http://en.wikipedia.org/w/api.php?%s' |
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
/* | |
Retarded simple event-binding "DSL" | |
Best with: | |
* jQuery (or Zepto) | |
* event_emitter | |
https://github.com/ajaxorg/ace/blob/master/lib/ace/lib/event_emitter.js | |
Usage: | |
tie($(window), "hashchange") |
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
#!/bin/sh | |
# | |
# We have a few repeat customers here at the TWU 27 hotdog shack. | |
# | |
# They've decided it's FUN to visit our stand. | |
# | |
# So, we've cooked up something a little special for our valued customers. | |
set -e |
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
NUM_POOLS = 5 | |
Grad = Struct.new :name, :gender, :region | |
def norm_name first, last | |
"#{first.strip} #{last.strip}" | |
end | |
def norm_gender gender | |
{'M' => 'Male', 'F' => 'Female'}[gender] || gender |