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
## reversesortby.rb | |
class ReverseSortBy | |
include Comparable | |
attr_reader :value | |
def initialize(value) | |
@value = value | |
end | |
def <=>(other) |
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
module Kernel | |
def irb_drop(context=nil, *argv) | |
require 'irb' | |
require 'pp' | |
require 'yaml' | |
original_argv = ARGV.dup | |
ARGV.replace(argv) # IRB is being stupid | |
IRB.setup(nil) # FIXME: must only be called once | |
irb = IRB::Irb.new(IRB::WorkSpace.new(context)) | |
IRB.conf[:IRB_RC].call(irb.context) if IRB.conf[:IRB_RC] # loads the irbrc? |
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
module Cucumber | |
module Rake | |
class Task | |
class BundledCucumberRunner #:nodoc: | |
attr_reader :args | |
def initialize(executable, cucumber_opts, feature_files) | |
@args = ( | |
[`which bundle`.chomp, 'exec', executable]+ | |
cucumber_opts + |
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 'set' | |
# Create and manage forks. | |
# Provides a basic facility to communicate between the forks and the parent | |
# | |
# Example: | |
# pool = ForkPool.new | |
# child = pool.fork do |parent| |
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
/* | |
Usage: | |
if (CssDetector.supports('box-shadow')) { | |
// load 'standard-box-shadows.css' | |
} else if (CssDetector.supports('-moz-box-shadow')) { | |
// load 'mozilla-box-shadows.css' | |
} else if (CssDetector.supports('-webkit-box-shadow')) { | |
// load 'webkit-box-shadows.css' | |
} else { | |
// load 'fake-box-shadows.css' |
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
BareTest.suite "Integer Division" do | |
data :integer_division, :csv, <<-DATA | |
@divident, @divisor, @expected_quotient | |
1, 1, 1 | |
1, 2, 0 | |
2, 2, 1 | |
DATA | |
setup data(:integer_division) |
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
Integer Division | |
[ success ] 1 divided by 1 returns an integer | |
[ success ] 1 divided by 2 returns an integer | |
[ success ] 2 divided by 2 returns an integer | |
[ success ] 1 divided by 1 equals 1 | |
[ success ] 1 divided by 2 equals 0 | |
[ success ] 2 divided by 2 equals 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
BareTest.suite "Integer Division" do | |
setup :addition do | |
@divident, @divisor, @expected_quotient = 1, 1, 1 | |
end | |
setup :addition do | |
@divident, @divisor, @expected_quotient = 1, 2, 0 | |
end | |
setup :addition do | |
@divident, @divisor, @expected_quotient = 2, 2, 1 | |
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
# An object representing a fork, containing data about it like pid, name, | |
# exit_status, exception etc. | |
# It also provides facilities for parent and child process to communicate | |
# with each other. | |
class Fork | |
# Exceptions that have to be ignored in the child's handling of exceptions | |
IgnoreExceptions = [::SystemExit] | |
# Raised when a fork raises an exception that can't be dumped | |
# This is the case if the exception is either an anonymous class or |
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
BareTest.suite do | |
suite "Success" do | |
assert "Returning a trueish value (non nil/false) is a success" do | |
true | |
end | |
end | |
suite "Failure" do | |
assert "Returning a falsish value (nil/false) is a failure" do | |
false |