Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am dm3 on github.
  • I am dm3 (https://keybase.io/dm3) on keybase.
  • I have a public key whose fingerprint is E75A 410C FD95 E482 D7FF 24E0 91D1 855F 5BA2 77EC

To claim this, I am signing this object:

@dm3
dm3 / gist:a1dacafb11617a722a96
Created September 8, 2014 17:57
Humane Submap clojure test matcher
(ns submap
(:require [clojure.test :as t]
[clojure.data :as d]
[pjstadig.humane-test-output :as hu]))
(hu/activate!)
(defmethod t/assert-expr 'submap? [msg [_ exp act]]
`(let [exp# ~exp, act# ~act
[only-exp# only-act# same#] (d/diff exp# act#)]
@dm3
dm3 / Simple Constraint Solver
Created January 31, 2013 12:23
Generate 'pretty' equations using JaCoP
public class Main {
private static final int MAX_POW = 3;
public static void main(String[] args) {
Store s = new Store();
IntVar a = new IntVar(s);
IntVar x0 = new IntVar(s), x1 = new IntVar(s), x2 = new IntVar(s);
IntVar c = new IntVar(s);
@dm3
dm3 / stoploss.clj
Created September 1, 2012 22:26
Trailing stop loss kata (https://gist.github.com/1500720)
(ns stoploss
(:use clojure.test)
(:gen-class))
; Helper
(defmacro defmessages [& es]
(vec (map (fn [e]
`(defn ~(symbol (name e)) [price#] [~e price#]))
es)))