Skip to content

Instantly share code, notes, and snippets.

View arwagner's full-sized avatar

Andrew Wagner arwagner

  • Northern Virginia
View GitHub Profile
@arwagner
arwagner / gist:1323952
Created October 29, 2011 01:13
Combinatorial explosion and testing
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?
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
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');
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'
class Article < ActiveRecord::Base
scope :published, where(:published => true)
scope :in_order, order('published_at desc')
end
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)
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
(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)))
#!/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
@arwagner
arwagner / _.md
Created January 18, 2013 20:51 — forked from enjalot/inlet.js
just another inlet to tributary