Skip to content

Instantly share code, notes, and snippets.

@csm
csm / recyclable.clj
Last active September 14, 2017 19:29
(import '[io.netty.util Recycler])
(defprotocol Recyclable
(recycle! [this] "Recycles this object."))
(defprotocol Init
(init! [this values]))
(defmacro defrecyclable
[name fields & {:keys [max-capacity] :or {max-capacity 8096}}]
(defn distinct-by
"Like distinct, but uses f to consider what duplicate values are."
([f]
(fn [rf]
(let [seen (volatile! #{})]
(fn
([] (rf))
([result] (rf result))
([result input]
(let [v (f input)]
@csm
csm / README
Created January 24, 2021 23:30
Start a in-memory S3-compatible (kinda...) server.
Uses https://github.com/csm/s4