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
# Turn darcs patches into git commits | |
# | |
# This code can handle: | |
# * adding files | |
# * modifying file contents | |
# * removing files | |
# * adding directories (ignored) | |
# * removing directories (ignored) | |
# * renaming files | |
# * renaming empty directories |
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
# My theme - ash.moran@patchspace.co.uk | |
# Based on Fino theme with bits from dallas and robbyrussell | |
# Fino notes: | |
# Use with a dark background and 256-color terminal! | |
# Meant for people with RVM and git. Tested only on OS X 10.7. | |
# You can set your computer name in the ~/.box-name file if you want. | |
# Borrowing shamelessly from these oh-my-zsh themes: | |
# bira |
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_relative 'test_helper' | |
require 'rack/test' | |
require 'minitest/autorun' | |
require 'capybara' | |
require 'capybara/dsl' | |
include Capybara::DSL | |
def app | |
MyApp::Server |
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 hash_options(args, defaults) | |
args.assert_valid_keys(*defaults.keys) | |
defaults.merge(args).values | |
end | |
def my_method(args = {}) | |
some, other, blah = | |
*hash_options(args, :some => 'value', other: 'value 2', blah: 'value 3') | |
# Use |
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
Fibonacci := Object clone | |
Fibonacci generate := method(n, | |
if(n == 1 or n == 2, 1, generate(n - 1) + generate(n - 2)) | |
) | |
Object Fibonacci := Fibonacci | |
describe(fibonacci, Fibonacci, | |
setup( |
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
OperatorTable println | |
"ADDING A NEW OPERATOR!!!" println | |
"" println | |
OperatorTable addOperator("^|", 11) | |
true ^| := method(bool, if(bool, false, true)) | |
false ^| := method(bool, if(bool, true, false)) | |
OperatorTable println |
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 'celluloid' | |
require_relative 'timers/null_timer' | |
require_relative 'timers/too_late_timer' | |
class MarketAgent | |
include Celluloid | |
class ActionError < RuntimeError; 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
class Organization | |
def to_param | |
"42" | |
end | |
def saved? | |
rand > 0.5 | |
end | |
end | |
class OrganizationCreator |
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 'spec_helper' | |
describe NIO::Monitor do | |
let :readable do | |
reader, writer = IO.pipe | |
writer << "have some data" | |
reader | |
end | |
let :selector do |
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 Ability | |
ReportAbility = AbilityBuilder.new do | |
def build | |
can :update_content, Report do |report| | |
report.being_edited_by?(user) | |
end | |
can :check_in_report, Report do |report| | |
report.being_edited_by?(user) | |
end | |
end |