This graphic illustrates string frequency over a period of time. Press left and right arrow keys to cycle through the data. A hash code adapted from Java is used to determine the color of the strings and the bars. log-scales are used to allow for visibility of small sample sizes at early time.
This file contains hidden or 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
;; Anti patterns | |
;; Implicit data manipulation anti-pattern | |
;; | |
;; Having nested calls manipulating data, instead of explicitly stating | |
;; what changes are performed to the data | |
(def h | |
[z] | |
;; ... |
This file contains hidden or 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
(defmacro aggregate | |
"Simple aggregation. Iterates over seq, binding values to | |
seq-bind. agg-bind is initially initial-val, but is bound to the value | |
of body after each iteration, and returned as the final value." | |
[agg-bind initial-val | |
[seq-bind seq] | |
& body] | |
`(reduce | |
(fn [~agg-bind ~seq-bind] | |
(do ~@body)) |
This file contains hidden or 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
(defn splits | |
[s] | |
(take-while | |
(comp seq second) | |
(iterate | |
(fn [[prefix suffix]] | |
[(conj prefix (first suffix)) | |
(rest suffix)]) | |
[[] s]))) |
The circular buttons use callback to update which of the two is selected.
Mouseover to repel nodes. Weee, nodes!
Example of how rolling deploys might have been easy on Datomic databases, had Datomic supported change of schema in db snapshots. The example will not work, but illustrates how easy it would have been to operate on a new schema on an old database by performing migration in-memory when needed.
This file contains hidden or 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
(use '[datomic.api :only [q db] :as d]) | |
(def uri "datomic:mem://schema-test") | |
(d/delete-database uri) | |
(d/create-database uri) | |
(def conn (d/connect uri)) | |
(def schema-tx |
This file contains hidden or 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 swing | |
(:import [javax.swing JFrame JLabel JButton] | |
[java.awt.event WindowListener])) | |
(defn swing [] | |
(let [frame (JFrame. "Fund manager") | |
label (JLabel. "Exit on close")] | |
(doto frame | |
(.add label) | |
(.setDefaultCloseOperation JFrame/EXIT_ON_CLOSE) |
This file contains hidden or 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
import java.util.Arrays; | |
public class Car { | |
private int maxSpeed; | |
private Wheel[] wheels; | |
public Car(int maxSpeed, Wheel[] wheels) { | |
this.maxSpeed = maxSpeed; | |
this.wheels = wheels; |