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 'gtk2' | |
require 'rubygems' | |
require 'dbi' | |
class Person | |
DB_FILE = 'db.sqlite' | |
@@db = nil | |
@@instances = [] |
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 File.dirname(__FILE__) + "/../test_helper" | |
class PlayingGameTest < Bbq::TestCase | |
include Bbq::SessionPool | |
background do | |
@admin = session_pool.create_user(TestUser, :driver => :selenium) | |
@admin.roles(:admin) | |
@admin.prepare_game_data |
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
class TestUser | |
def wait(seconds) | |
sleep seconds.to_i | |
end | |
def wait_for_server(timeout = 10.seconds) | |
page.wait_until(timeout.to_i) do | |
page.evaluate_script 'jQuery.active == 0' | |
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
#!/bin/sh | |
git "$@" |
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
class Countdown | |
constructor: (@clock, @seconds) -> | |
$.extend(this, new Observable) | |
@finished = false | |
start: => | |
fn = => | |
this.trigger("updated", @seconds) | |
@seconds-- | |
if @seconds >= 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
class Session | |
# some kind of delegator is needed here | |
# delegate everything to @session | |
def initialize(options) | |
@session = Capybara::Session.new(options[:driver], Bbq.app) | |
end | |
def kill | |
page.driver.quit if page.driver.browser? |
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
jasmine.Spy.prototype.andReturnDeferred = -> | |
@deferreds = [] | |
@resolve = => | |
unless @deferreds.length > 0 | |
throw "Cannot resolve, #{@identity} was not called" | |
dfr = @deferreds.shift() | |
dfr.resolve() | |
@reject = => | |
unless @deferreds.length > 0 | |
throw "Cannot reject, #{@identity} was not called" |
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
# suite ["shooter", "acceptance"], -> ... | |
# is equivalent to: | |
# describe "shooter", -> | |
# describe "acceptance", -> ... | |
window.suite = (names, block) -> | |
name = names.shift() | |
if names.length > 0 | |
describe(name, -> suite(names, block)) | |
else |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#define AVL_AS_LIST | |
typedef int AvlKey; | |
struct AvlNode { | |
AvlKey key; | |
char balance; |
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
def m1 | |
/(a)/.match("abc") | |
p $1 | |
m2() | |
p $1 | |
end | |
def m2 | |
/(b)/.match("abc") | |
p $1 |