Skip to content

Instantly share code, notes, and snippets.

(ns ezducerdemo)
;; 1st take
(defn ezducer [constructor]
(fn [reducer]
(let [steps (fn [a vs]
;; Use loop/recur instead of reduce to avoid reduce's
ghadishayban / functional_interfaces.clj
Last active February 4, 2019 17:52
SAM inference helpers
(import '[java.lang.reflect Method Modifier])
(set! *warn-on-reflection* true)
(defn- samsig
"Given a SAM interface, returns the j.l.reflect.Method of the abstract method"
(let [kls (resolve sym)]
(if (and (class? kls) (.isInterface ^Class kls))
(let [mid (fn [^Method m] [(.getName m) (vec (.getParameterTypes m))])
ghadishayban /
Created February 12, 2018 01:46
a script that vendors asm and writes itself as git commit 'transaction data'
# author Ghadi Shayban <>
set -e
if [ -z ${1+x} ]
echo provide an asm git sha / ref
exit 1
devn / todo.exs
Last active December 1, 2017 22:38
do todo
defmodule Do do
def dont think, about, it, but, please do
[think, about, it, please]
Do.dont :worry, :about, :grouping, :any, :arguments
=> [:worry, :about, :grouping, :arguments]
pjstadig / core.clj
Created March 20, 2017 13:06
A little type hint hint
(ns typehint.core)
;; A little type hint hint...
(set! *warn-on-reflection* true)
;; There are two ways to type hint the return value of a function, but one is
;; (technically) wrong:
(defn ^String as-string0
noprompt / strum.clj
Created December 22, 2016 19:52
Macro for defining instrumented functions which verify their arguments and return values against specs.
(ns strum.core
(:refer-clojure :exclude [defn])
[clojure.spec :as spec]
[clojure.spec.test :as spec.test]))
;; ---------------------------------------------------------------------
;; Prelude
;; HACK: Currently, as of Clojure 1.9.0-alpha14, there is a bug with
lrascao / gist:f57312ff33b799c4c0db56b10e80fe26
Created March 31, 2016 16:19
Export/Import datadog dashboards
# 1. export
curl -X GET "${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json
# 2. edit dash.json
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level