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 / sketch.rb
Created June 29, 2012 16:04 — forked from mattwynne/sketch.rb
sketch for Matt Wynne
# Specs
describe "a sucessful create" do
it "redirects" do
Organization.any_instance.stub(:saved? => true)
controller = OrganizationsController.new
controller.should_receive(:redirect_to)
controller.create
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 / 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
@mowat27
mowat27 / index.html
Last active August 29, 2015 14:13 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.node {
font: 11px "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.link {
stroke: steelblue;