This file contains hidden or 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 ScoreHelpers | |
def the_letter(letter, options) | |
score = options[:is_worth] | |
# TODO Remember the letter's score for the current example group. | |
end | |
end | |
module ScoreMatchers | |
extend RSpec::Matchers::DSL |
This file contains hidden or 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 ScoreHelpers | |
def self.extended(base) | |
base.class_eval do | |
let(:scores) { {} } | |
end | |
end | |
def the_letter(letter, options) | |
score = options[:is_worth] |
This file contains hidden or 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 'active_support/time' | |
require 'active_support/testing/time_helpers' | |
require 'rspec/expectations' | |
include ActiveSupport::Testing::TimeHelpers | |
include RSpec::Matchers | |
class Person < Struct.new(:birthday) | |
def age | |
Date.today.year - birthday.year | |
end |
This file contains hidden or 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
$ mkdir ~/.boot2docker | |
$ curl http://static.dockerfiles.io/boot2docker-v1.0.0-virtualbox-guest-additions-v4.3.12.iso > ~/.boot2docker/boot2docker.iso | |
$ boot2docker init | |
$ VBoxManage sharedfolder add boot2docker-vm -name home -hostpath /Users | |
$ boot2docker up | |
$ sudo sh -c "echo `boot2docker ip 2>/dev/null` boot2docker >> /etc/hosts" | |
$ echo export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 >> .bash_profile |
This file contains hidden or 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 'rspec/core' | |
examples = RSpec.describe 'a "Hello world" object' do | |
before(:each) do | |
@hello_world = HelloWorld.new | |
end | |
it 'says "Hello world"' do | |
raise unless @hello_world.message == 'Hello world' | |
end |
This file contains hidden or 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
$ cat Gemfile | |
source 'https://rubygems.org/' | |
$ time ruby -e 'puts "Hello world"' | |
Hello world | |
real 0m0.197s | |
user 0m0.117s | |
sys 0m0.073s |
This file contains hidden or 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
[ | |
{ | |
"textToMatch": "HISCOX", | |
"description": "Liability & indemnity insurance", | |
"vat": "0", | |
"category": "Insurance", | |
"shouldHaveAttachment": false, | |
"ecStatus": "Non-EC" | |
}, | |
{ |
This file contains hidden or 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 BWT | |
def encode(string) | |
chars = string.chars + ['$'] | |
chars.each_index.map(&chars.method(:rotate)).sort.map(&:last).join | |
end | |
def decode(string) | |
chars = string.chars | |
chars.inject([]) { |table| chars.zip(table).sort }. | |
map(&:join).detect { |s| s.end_with?('$') }.chop |
This file contains hidden or 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
before function call: at start of function call: | |
ARG: args for caller args for caller | |
saved state for caller saved state for caller | |
LCL: locals for caller locals for caller | |
stack for caller stack for caller | |
args for callee --> ARG: args for callee | |
SP: saved state for callee | |
LCL: locals for callee | |
SP: |
This file contains hidden or 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
#http://www.nhs.uk/NHSEngland/Healthcosts/Pages/Prescriptioncosts.aspx | |
Given a user who is 60 or older | |
When they collect a prescription | |
Then it should be free | |
Given a user who is younger than 16 | |
When they collect a prescription | |
Then it should be free |