Skip to content

Instantly share code, notes, and snippets.

View mowat27's full-sized avatar

Adrian Mowat mowat27

  • Fort William, Scotland
View GitHub Profile
@mowat27
mowat27 / Questions.md
Created November 30, 2013 11:11
Preparation for the Single Piece Flow Talk - Lean Agile Glasgow 11 December 2013
  • How much time do I have?

10 minute lightnight talk

  • What's the venue like?

Spaark's offices. Not sure where but it will be a semi-formal setting, probably in a meeting room or breakout area

  • At what time of day will I be presenting?
@mowat27
mowat27 / questions.md
Last active December 27, 2015 14:09
Presentation Preparation
  • How much time do I have?

  • What's the venue like?

  • At what time of day will I be presenting?

  • Who is the audience?

  • What's their background?

@mowat27
mowat27 / story_creator_spec.rb
Last active December 25, 2015 04:39
Trigram kata for 10/10/2013
require 'rspec-given'
class StoryCreator
def initialize(story, selector_fn = nil)
@story = story
@selector_fn = selector_fn
end
def new_story
trigram = {
@mowat27
mowat27 / aliases.sh
Created October 10, 2013 07:10
Scripts for working to todo.txt - as of 10 Cot 2013
alias tlss='t ls | sort'
alias tgrep='tlss | grep'
alias tas='t add @stuff'
alias tad='t add @delegate'
alias taw='t add @wait'
alias tat='t add @today'
alias tal='t add @later'
PATH=~/Dropbox/todo/bin:$PATH
@mowat27
mowat27 / word_count.rb
Last active December 22, 2015 16:49 — forked from joejag/word_count.rb
Made the relationship between words cleaner and frequencies more cohesive. I would look at the naming of WordsCleaner now but I don't want to mess with the code too much and fail to demonstrate the core point - perhaps Tokeniser would be more descriptive though
class Phrase
def initialize(words)
words_cleaner = WordsCleaner.new(words)
@frequency_counter = Frequencies.new(words_cleaner)
end
def word_count
@frequency_counter.frequencies
end
end
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@mowat27
mowat27 / chop2.rb
Created September 9, 2013 16:25
First working version on binary chop. May try an OO version next time
require 'rspec-given'
module Chop
def chop(coll, search, i = 0)
return nil if bad_search?(coll, search)
middle = coll.count / 2
return i if coll.first == search
if coll[middle] <= search
chop(coll[middle..-1], search, i + middle)
else
@mowat27
mowat27 / chop1.rb
Last active December 22, 2015 03:28
Binary Chop kata
require 'rspec-given'
# Really, really, really going nowhere with this at the moment :-(
class Chop
def initialize(list)
@list = list
end
def find(item, start = 0)
mid_point = @list.length / 2
@mowat27
mowat27 / word_count1.rb
Created August 25, 2013 21:14
Implemented the word count kata using red-refactor-green and dependency injection. I think I went wrong with the count class - it's a value object wrapping a Hash. Next time, I'll try wrapping the actual word count.
require 'rspec-given'
describe "word counter" do
Given(:word_counter) { WordCounterFactory.new.create }
Then { word_counter.count("one") == {"one" => 1} }
Then { word_counter.count("one fish") == {"one" => 1, "fish" => 1} }
Then { word_counter.count("one fish fish") == {"one" => 1, "fish" => 2} }
Then { word_counter.count("one fish,fish") == {"one" => 1, "fish" => 2} }
Then { word_counter.count("one fish Fish") == {"one" => 1, "fish" => 2} }
Then { word_counter.count("one fish Fish") == {"one" => 1, "fish" => 2} }
@mowat27
mowat27 / calculator.rb
Last active December 21, 2015 11:29
First stab at the string calculator kata using red-refactor-green and dependency injection as my only refactoring
describe "calculator" do
let(:calculator) { CalculatorFactory.new.create }
it "adds numbers" do
calculator.calculate("1 + 2").should == 3
end
it "adds big numbers" do
calculator.calculate("11 + 22").should == 33
end