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
package ocpCalc; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class CalculatorFactory { | |
public Calculator create() { | |
BinaryInfixParser arithmeticParser = new BinaryInfixParser(operators()); | |
Parser parser = new EmptyStringParser(arithmeticParser); |
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
import static org.junit.Assert.*; | |
import org.junit.Before; | |
import org.junit.Test; | |
public class OsheroveTests { | |
private Calculator calculator; | |
@Before | |
public void setUp() throws Exception { |
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
public class Checkout { | |
private Money balance = Money.ZERO; | |
private MultibuyDiscount discount; | |
public Checkout(MultibuyDiscount discount) { | |
this.discount = discount.reset(); | |
} | |
public Checkout scan(String sku, Money price) { |
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 'machine' | |
require 'robot' | |
describe Robot do | |
before :each do | |
@robot = Robot.new | |
end | |
describe 'when new' do | |
it 'should have no location yet' 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
def parse(arg, argv, &error) | |
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0])) # should count as 2 | |
return nil, block, nil | |
end | |
opt = (val = parse_arg(val, &error))[1] # counts as 1; should count as 2 | |
val = conv_arg(*val) | |
if opt and !arg # counts as 1; should count as 2 (or 3?) | |
argv.shift | |
else | |
val[0] = nil |
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 Book do | |
it_should_behave_like 'a visitable item' | |
# more specs ... | |
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
shared_examples_for 'a visitable item' do | |
its(:name) { should_not be_nil } | |
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 MyController < ApplicationController | |
def show | |
@sysinfo = SysInfo.new(model_stuff, ...) | |
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
$ cd ~ | |
$ rm -rf .rvm | |
$ curl -L https://get.rvm.io | bash -s stable | |
# ... | |
$ type rvm | head -n 1 | |
rvm is a function | |
$ rvm install 1.8.7 | |
# ... | |
$ rvm use 1.8.7 | |
# ... |
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
$ uname -a | |
Linux kr-laptop 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux | |
$ rvm implode | |
# and edit .bashrc to remove RVM stuff there | |
# No RVM packages installed, no RVM gem, no other RVM config files found | |
$ curl -L https://get.rvm.io | bash -s stable | |
#... | |
rvm 1.14.2 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/] | |
$ . /home/kevin/.rvm/scripts/rvm |
OlderNewer