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
wget -O ~/deleting_code.mp3 https://dl.dropbox.com/u/2233/deleting_code.mp3 | |
echo '#!/usr/bin/env ruby | |
deletions = `git diff HEAD --numstat`.lines.to_a.map do |l| | |
l.split(" ") | |
end.map do | |
|(add,del,_)| del.to_i - add.to_i | |
end.inject(:+).to_i |
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
Bundle 'Lokaltog/vim-powerline' | |
Bundle 'scrooloose/nerdtree' | |
Bundle 'wincent/Command-T' | |
Bundle 'benmills/vimux' | |
Bundle 'jbrechtel/vimux-ruby-test' | |
Bundle 'tpope/vim-endwise' | |
Bundle 'edsono/vim-matchit' | |
Bundle 'vim-ruby/vim-ruby' | |
Bundle 'mileszs/ack.vim' | |
Bundle 'desert-warm-256' |
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
(defn cell-state [room x-pos y-pos] | |
(cond | |
(> 0 x-pos) :wall | |
(> 0 y-pos) :wall | |
(<= (count room) x-pos) :wall | |
(<= (count room) y-pos) :wall | |
:else ((room x-pos) y-pos))) | |
(defn agent-state [room, x-pos, y-pos] | |
(let [current (cell-state room x-pos y-pos) |
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 possible-states [:clean :dirty :wall]) | |
(def state-permutations | |
(for [north possible-states, | |
south possible-states, | |
east possible-states, | |
west possible-states, | |
curr possible-states] | |
{:north north :south south :east east :west west :current curr})) |
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
(defn breed [parent-a parent-b] | |
(let [breed-index (rand (count parent-a)) | |
transmission-a (take breed-index parent-a) | |
transmission-b (drop breed-index parent-b) | |
pure-child (concat transmission-a transmission-b)] | |
mutate-agent pure-child)) |
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
{"mobileview":{"sections":[{"id":0,"text":""},{"toclevel":1,"line":"English","id":1,"text":"<h2><span class=\"mw-headline\" id=\"English\">English<\/span><\/h2>\n<div class=\"sister-wikipedia sister-project noprint floatright\" style=\"border: 1px solid #aaa; font-size: 90%; background: #f9f9f9; width: 250px; padding: 4px; text-align: left;\">\n<div style=\"float: left;\">\n<div class=\"floatnone\"><span class=\"mw-mf-image-replacement\">[Image]<\/span><\/div>\n<\/div>\n<div style=\"margin-left: 60px;\"><a href=\"\/wiki\/Wikipedia\" title=\"Wikipedia\">Wikipedia<\/a> has an article on:\n<div style=\"margin-left: 10px;\"><b class=\"Latn\" lang=\"en\" xml:lang=\"en\"><a href=\"\/\/en.wikipedia.org\/wiki\/This\" class=\"extiw\" title=\"w:This\">This<\/a><\/b><\/div>\n<\/div>\n<\/div>\n<p><span class=\"interProject\"><a href=\"\/\/en.wikipedia.org\/wiki\/This\" class=\"extiw\" title=\"w:This\">Wikipedia<\/a><\/span><\/p>"},{"toclevel":2,"line":"Etymology","id":2,"text":"<h3><span class=\"mw-headline\" id=\"Etymol |
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
clojoomba.core.runner=> (time (count (nth (clojoomba.core.evolution/evolutions {:agents (gen-agents 20) :room-size 10 :num-rooms 10 :steps 200}) 2))) | |
"Elapsed time: 133.896 msecs" | |
20 | |
clojoomba.core.runner=> (time (count (nth (clojoomba.core.evolution/evolutions {:agents (gen-agents 20) :room-size 10 :num-rooms 10 :steps 200}) 2))) | |
"Elapsed time: 121.748 msecs" | |
20 | |
clojoomba.core.runner=> (time (count (nth (clojoomba.core.evolution/evolutions {:agents (gen-agents 20) :room-size 10 :num-rooms 10 :steps 200}) 2))) | |
"Elapsed time: 113.795 msecs" | |
20 | |
clojoomba.core.runner=> (time (count (last (take 2 (clojoomba.core.evolution/evolutions {:agents (gen-agents 20) :room-size 10 :num-rooms 10 :steps 200}))))) |
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 Foo { | |
val emailer: EmailService | |
} | |
trait Fakes { | |
val emailer = new FakeEmailService() | |
} | |
trait RealThings { | |
val emailer = new SmtpEmailService() |
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
;not sure why this doesn't really memoize the anonymous function call | |
(defn add [a b] ((memoize (fn [x y] (Thread/sleep 1000) (+ x y))) a b)) | |
;this does correctly memoize the (non anonymous) function call | |
(defn adds [a b] (Thread/sleep 1000) (+ a b)) | |
(def addf (memoize adds)) |