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
snip from spec file: | |
KNOWN_STATS = [SPEC_EXAMPLE_FILE, 0.570645834224529, 0.586986749301636, 3.40291187981663, 3.70043971814109, 22] | |
it 'should return the known statistics about a.rb' do | |
stats = @c.process_directory(SPEC_FILE_DIR)[SPEC_EXAMPLE_BASE][0] | |
stats.should == KNOWN_STATS | |
end | |
output: |
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
FORKIFY_DEBUG = false | |
require 'pp' | |
require 'rinda/tuplespace' | |
module Enumerable | |
# | |
# Forkify will process _block_'s actions using processes. If no number of processes is | |
# given, the default of 5 will be used. If there are less than _procs_ number of items |
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
# Stripped down version of the parent's job | |
pts = Rinda::TupleSpace.new | |
items.each_with_index { |item, index| | |
pts.write([:enum, index, item]) | |
} | |
provider = nil | |
provider = DRb.start_service('druby://127.0.0.1:53421', pts) |
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
# Stripped down Child | |
pid = fork | |
unless pid | |
DRb.start_service | |
# fetch the TupleSpace over DRb using a proxy object | |
ts = Rinda::TupleSpaceProxy.new(DRbObject.new_with_uri('druby://127.0.0.1:53421')) | |
loop do | |
# break if no more items in the queue |
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
[hinmanm@Xanadu:~]% rvm-update | |
sh: bash -l -c 'cd /Library/Ruby/Gems/1.8/gems/rvm-0.0.26 && ./scripts/rvm-update && source ~/.rvm/scripts/rvm': No such file or directory | |
[hinmanm@Xanadu:~]% cd /Library/Ruby/Gems/1.8/gems/rvm-0.0.26 && ./scripts/rvm-update && source ~/.rvm/scripts/rvm | |
<i> Updating rvm source ~/.rvm/scripts/rvm ... | |
<w> Ensuring that rvm script location in /Users/hinmanm/.zshrc is scripts/rvm not bin/rvm | |
<i> There have been a great many updates since previous releases, please: |
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
[2:hinmanm@Xanadu:~]% ruby -v | |
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] | |
[2:hinmanm@Xanadu:~]% sudo gem install duration | |
Successfully installed duration-0.1.0 | |
1 gem installed | |
Installing ri documentation for duration-0.1.0... | |
Updating class cache with 3078 classes... | |
Installing RDoc documentation for duration-0.1.0... | |
[2:hinmanm@Xanadu:~]% irb | |
1.9.1 >> require 'duration' |
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
[2:hinmanm@Xanadu:~]% ruby -v | |
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10.0.0] | |
[2:hinmanm@Xanadu:~]% rvm system | |
[2:hinmanm@Xanadu:~]% sudo gem install rvm | |
Successfully installed rvm-0.0.28 | |
1 gem installed | |
Installing ri documentation for rvm-0.0.28... | |
Installing RDoc documentation for rvm-0.0.28... | |
[2:hinmanm@Xanadu:~]% rvm default | |
[2:hinmanm@Xanadu:~]% rvm-update |
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
[2:hinmanm@Xanadu:~]% rvm reset | |
[2:hinmanm@Xanadu:~]% ruby -v | |
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0] | |
[2:hinmanm@Xanadu:~]% rvm-update | |
<i> Updating rvm source ~/.rvm/scripts/rvm ... | |
<w> Ensuring that rvm script location in /Users/hinmanm/.zshrc is scripts/rvm not bin/rvm | |
<i> There have been a great many updates since previous releases, please: |
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
(ns bibly.servlet | |
(:gen-class :extends com.google.wave.api.AbstractRobotServlet) | |
(:import | |
[com.google.appengine.api.users UserServiceFactory] | |
[com.google.wave.api Blip Event EventType RobotMessageBundle TextView Wavelet]) | |
(:require [clojure.contrib.str-utils :as str-utils] | |
[clojure.contrib.str-utils2 :as str-utils2])) | |
(defn blip-submitted-events | |
[events] |
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
#!/Users/hinmanm/bin/clj | |
; Index of Coincidence | |
(use '[clojure.contrib.duck-streams :only (reader file-str)]) | |
(use '[clojure.contrib.str-utils2 :only (join)]) | |
(defn ioc-base | |
"Returns the Index of Coincidence for a given shift and list of | |
numbers as a percentage." | |
[s n] | |
(let [pairs (partition s 1 n) |