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
commentor.should_receive(:add).with(anonymous_comment) |
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 Board | |
def initialize | |
@living = [] | |
end | |
def evolve_dead_cells | |
end | |
def add_living_cell(location) |
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
# When doing this: | |
class SomeError < Exception | |
def initialize(some, args); end | |
end | |
describe 'bad message' do | |
it 'raises an exception' do | |
obj = stub | |
obj.should_receive(:dude!).and_raise(SomeError) |
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
Object.const_defined? :Integer | |
#=> true |
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
// Why write this.. | |
public static <T, V> Map<T, List<V>> defaultdict_list() { | |
return new MapMaker().makeComputingMap(new Function<T, List<V>>() { | |
@Override public List<V> apply(T unusedCrap) { | |
return Lists.newArrayList(); | |
} | |
}); | |
} | |
# When you just want this (Python) |
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
From 9c168445300c6fda62173d37fbbbffa1a2136e03 Mon Sep 17 00:00:00 2001 | |
From: Aviv Ben-Yosef <aviv.by@gmail.com> | |
Date: Wed, 8 Jun 2011 11:10:11 +0300 | |
Subject: [PATCH] Fix SortedSet to ensure objects comparable with <=> | |
Fixes 2 failing specs for SortedSet: | |
- SortedSet#add takes only values which responds <=> | |
- SortedSet#initialize takes only values which respond to <=> | |
--- | |
lib/set.rb | 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
describe 'cart' do | |
it 'allows discount after purchasing certain amount' do | |
product = Product.new('Snickers', 3) | |
cart = Cart.new | |
6.times { cart << product } | |
cart.when_buying(product).times(5).get(1).free() | |
cart.total.should == 5*3 |
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
name "appserver" | |
description "An application server" | |
run_list(%w{ | |
recipe[apache2] | |
}) |
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 default_node { | |
package { 'apache2': | |
ensure => installed | |
} | |
service { 'apache2': | |
ensure => true, | |
enable => true, | |
require => Package['apache2'], | |
} | |
} |
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 void bind() { | |
display.getSaveButton().addClickHandler( | |
new ClickHandler() { | |
@Override public void click(ClickEvent e) { | |
// Magic happens here | |
} | |
}); | |
} |