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 monads.core | |
(:use [clojure.algo.monads | |
:only (domonad with-monad m-lift m-seq m-reduce m-when | |
identity-m | |
sequence-m | |
maybe-m | |
state-m fetch-state set-state | |
writer-m write | |
cont-m run-cont call-cc | |
maybe-t)])) |
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 words "down before how around quickly off been does thing story book kind has near list quite set read keep with form boy who such she made play be say open call mountain said state light show one to for her work here left when hear as our place just thing are ask study need were even something question great close that begin us tell while side then here word high take his other who grow talk above learn it father few did what oil face over even those spell does number down in work where go might we add right mile story letter some much before big he car help don't came take come river about between food any much begin between these all thought being than few example why again face three its something your high but miss country add old from should should there about song no same who same land school mile own more found know have see did important know head seem set need got ask almost must school my its when air right here question did thing four is think follow go show soon also change or after such not |
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
describe "StringCalculator" => sub { | |
it "returns sum of comma delimited numbers" => sub { | |
is(add("$a,$b"), $a + $b); | |
}; | |
it "treats newline as delimiter" => sub { | |
is(add("$a\n$b"), $a + $b); | |
}; | |
describe 'delimiter marker //<delimiter-spec>\n' => sub { |
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
func parse_time($str) { | |
# Mapping from whisper.py | |
my %unit_multiplier = ( | |
s => 1, | |
m => 60, | |
h => 3600, | |
d => 86400, | |
w => 86400 * 7, | |
y => 86400 * 365 | |
); |
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
;; Alternatives - http://www.clojure-toolbox.com (Database Migrations) | |
(ns wools.models.migration | |
(:require [clojure.java.jdbc :as sql])) | |
(def migrations | |
[{:id "create balance table" | |
:up #(sql/create-table :balance | |
[:ts :timestamp "NOT NULL" "DEFAULT CURRENT_TIMESTAMP"] | |
[:amount :int "NOT NULL"])}]) |
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
;; Port of Coderush's smart semi-colon feature to Emacs | |
;; | |
;; When I hit semi-colon anywhere, Emacs will move cursor to the end of current | |
;; line and insert semi-colon (if it's not already there). | |
;; | |
;; Idea from last @CoderetreatCZ - HK | |
(defun maio/electric-semicolon () | |
(interactive) | |
(end-of-line) |
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
describe("TODO List", function() { | |
beforeEach(function() { | |
storage = new TestCookieStorage; | |
tasks = storage.load_tasks(); | |
users = storage.load_users(); | |
}); | |
it("loads tasks from storage", function() { | |
expect(tasks.length).toEqual(1); | |
}); |
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
nmap P :call <SID>pasteAbove()<CR> | |
nmap p :call <SID>pasteBelow()<CR> | |
fun! s:pasteAbove() | |
let indentDiff = s:detectIndentDiff("O") | |
exe "norm! P" | |
call s:fixPasteIndent(indentDiff) | |
endfun | |
fun! s:pasteBelow() |
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
# Perl clone of: | |
# https://github.com/pivotal/jasmine/wiki/Matchers | |
# https://github.com/pivotal/jasmine/wiki | |
use Test::Spec; | |
# usage | |
describe 'Expect' => sub { | |
describe 'implementing matcher' => sub { | |
it toEqual => sub { |
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
public void testGetTotalPriceReturnsSumOfAllItemsPrices() { | |
basket.addItem(new Item(1)); | |
basket.addItem(new Item(2)); | |
assertThat(basket.getTotalPrice(), is(3)); | |
} | |
public void testClearMakesBasketEmpty() { | |
basket.addItem(new Item()); | |
basket.clear(); |