[ Launch: just another inlet to tributary ] 4568428 by arwagner
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
I found http://groups.google.com/group/growing-object-oriented-software/browse_thread/thread/47695af2c6b5adda fascinating, so I decided to make it a little more concrete. It's also in ruby using rspec, sorry about that. Here's the code under test: | |
class EligibleForDiscountPolicy | |
def initialize transaction, user | |
@transaction = transaction | |
@user = user | |
end | |
def decide | |
return true if @user.is_gold_member? |
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
Device Identifier: disk2 | |
Device Node: /dev/disk2 | |
Whole: Yes | |
Part of Whole: disk2 | |
Device / Media Name: SD Card Reader | |
Volume Name: Not applicable (no file system) | |
Mounted: Not applicable (no file system) | |
File System: None |
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
console.log(process.argv); | |
if (process.argv.length != 7){ | |
console.log("Usage: node challenge.js <timestamp> <status> <challenger> <challengee> <comment>"); | |
process.exit(); | |
} | |
var data = [process.argv[2], process.argv[3], process.argv[4], process.argv[5], process.argv[6]] | |
var spreadsheet = require('./spreadsheet'); |
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
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'foobarService' defined in file [/Users/wagnera/workspace/j+hs/onboard/onboardservices/target/classes/com/agilex/onboardservices/services/FoobarService.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Property 'text' is required for bean 'foobarService' |
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 Article < ActiveRecord::Base | |
scope :published, where(:published => true) | |
scope :in_order, order('published_at desc') | |
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
pedestal git:(master) pwd | |
//Users/andrewwagner/workspace/clojure/pedestal | |
➜ pedestal git:(master) lein classpath | |
/Users/andrewwagner/workspace/clojure/pedestal/test:/Users/andrewwagner/workspace/clojure/pedestal/src:/Users/andrewwagner/workspace/clojure/pedestal/dev-resources:/Users/andrewwagner/workspace/clojure/pedestal/resources:/Users/andrewwagner/workspace/clojure/pedestal/target/classes | |
➜ pedestal git:(master) |
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 foo obj | |
obj.bar(1) | |
obj.bar(2) | |
end | |
describe "foo" do | |
it "calls bar on obj" do | |
obj = stub | |
obj.should_receive(:bar).with(2) | |
foo obj |
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
(defrecord Hashtable [hash-function data]) | |
(defn create-hashtable [f] | |
(Hashtable. f {})) | |
(defn contains? [ht item] | |
(let [map (:data ht) | |
key ((:hash-function ht) item)] | |
(map key))) |
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
#!/usr/bin/env ruby | |
i = 0 | |
moves = ["a7a6","a6a5","a5a4","a4a3"] | |
ARGF.each do |command| | |
if command.start_with?("protover") | |
$stdout.puts "feature ping=0 setboard=1 ics=1 usermove=1" | |
elsif command.start_with?("usermove") | |
$stdout.puts "move #{moves[i]}" | |
i+=1 |
NewerOlder