Skip to content

Instantly share code, notes, and snippets.

@wvdlaan
wvdlaan / berlin-clock.cljs
Last active July 20, 2016 19:15 — forked from skuro/berlin-clock.cljs
Berlin Clock kata as implemented at the Amsterdam Clojurians cljs dojo, meetup #80
(ns berlin-clock.core
(:require
[sablono.core :as sab :include-macros true])
(:require-macros
[devcards.core :as dc :refer [defcard deftest]]))
(enable-console-print!)
(defn get-clock-data
[hh mm ss]
@wvdlaan
wvdlaan / advocaat.clj
Last active March 11, 2016 13:31 — forked from skuro/README.md
Lotsa advocaat
(ns advocaat.core)
(def barrels [50 44 11 49 42 46 18 32 26 40 21 7 18 43 10 47 36 24 22 40])
(def advocaat-amount 150)
;; imagine there are only two barrels: [50 44]
;; with these two barrels the complete list of all possible combinations is:
;; 50*0 + 44*0 => 0
;; 50*0 + 44*1 => 44
;; 50*1 + 44*0 => 50
@wvdlaan
wvdlaan / gist:9f47b50ea7bede4570ff
Last active January 13, 2016 20:18
Game of life dojo
(ns gol.core
(:require
[reagent.core :as reagent]
[sablono.core :as sab :include-macros true])
(:require-macros
[devcards.core :as dc :refer [defcard deftest defcard-rg]]))
(enable-console-print!)
(defn neighbours
(ns chal209.unpack
(:require [clojure.string :refer [split]]
[clojure.set :refer [difference]]))
(def input1
"6 1 1
T H T L E D
P E N U R G
I G S D I S
Y G A W S I
(ns dojo.core
(:require [clojure.math.combinatorics :as combo]
[clojure.set :as cs]))
(def board
[[0 1 0]
[0 0 0]
[1 0 0]])
(def human-board
@wvdlaan
wvdlaan / nonograms.clj
Last active August 29, 2015 14:11 — forked from skuro/nonograms.clj
(ns dojo3.core)
(def x {:size [10 10]
:rows [[] [1 1] [1] [2 1 1] [1 1 1] [1 2 1 1] [1] [1] [] []]
:cols [[] [1] [] [3] [1 1] [] [5] 1 [] [1 4 []]]})
(def nono1 {:size [3 3]
:rows [[1] [3] [1]]
:cols [[1] [3] [1]]})
(ns dojo.core
(:require [clojure.string :as str]))
(defn parse-line
[l]
(->> (take 3 l)
(map #(partition 3 %))
(apply map vector)))
(defn parse
@wvdlaan
wvdlaan / core.clj
Last active March 16, 2018 06:53
Datomic multiple attribute key example
(ns myupsert.core
(require [datomic.api :as d]))
(def schema
[
{:db/id #db/id [:db.part/db]
:db/ident :product/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}