Skip to content

Instantly share code, notes, and snippets.


Jeroen van Dijk jeroenvandijk

View GitHub Profile
jeroenvandijk / smart_middleware.clj
Last active Feb 9, 2022
An example of composing ring middleware in a more robust and intuitive way?
View smart_middleware.clj
;; When middleware comes with a certain dependency order things get a bit tedious and error prone.
;; Consider example 1 below:
(defn add-cmd [req cmd]
(update req :cmd (fnil conj []) cmd))
(defn add-cmd-handler [cmd]
(fn [req]
jeroenvandijk / kahn_sort.clj
Last active Jan 20, 2022
Malli composite schema that reuses the values of the underlying values during data generation
View kahn_sort.clj
;; Copy of
;; Copyright (c) Alan Dipert. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns alandipert.kahn
jeroenvandijk / com.plex.pms.plist
Created Jan 18, 2022 — forked from wahlmanj/com.plex.pms.plist
Plex Media center startup plist for use with launchctl
View com.plex.pms.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
<plist version="1.0">
View bookmarklet-search-in-clojurians-slack-archive.cljs
{:name "Search the Clojurians Slack-archive"
:author "Gert Goet"
:license "MIT"}
(when-some [q (js/prompt "Search the Clojurians Slack-archive:")]
(.open js/window (str "" q)))
jeroenvandijk / sorted.clj
Last active Jul 3, 2020
Babashka script for sorting clojure code lines
View sorted.clj
#!/usr/bin/env bb
(doseq [line (->> (file-seq ( (System/getenv "PWD")))
(filter #(.isFile %))
(filter (fn [f] (contains? #{"clj" "cljc" "cljs" "bb"}
(last (clojure.string/split (.getName f) #"\.")))))
(mapcat #(clojure.string/split-lines (slurp %)))
(println line))
jeroenvandijk / multitime.clj
Last active Jun 12, 2020
Idea for multitime test in Babashka
View multitime.clj
;; Like but with the power of Clojure: multi-processor, shuffling, advanced statistics
;; export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {org.clojure/data.generators {:mvn/version "1.0.0"}, org.clojure/math.combinatorics {:mvn/version "0.1.6"}}}' -Spath)
(require '[clojure.math.combinatorics :as combo]
'[ :as gen])
(let [binaries ["../sci/tmp/sci-25ace7c"
jeroenvandijk / repl_usage.txt
Created May 8, 2020
Babashka spire pod wrapper
View repl_usage.txt
user=> (babashka.pods/load-pod "./")
user=> (require '[pod.babashka.spire :as spire])
user=> (spire/magic! )
#error {
:cause "Invalid netstring. Unexpected end of input."

Keybase proof

I hereby claim:

  • I am jeroenvandijk on github.
  • I am jeroenvandijk ( on keybase.
  • I have a public key whose fingerprint is EABD B08B 7E40 0750 54C2 9F31 1BDC C90E A3CA BA2D

To claim this, I am signing this object:

jeroenvandijk / sci_google_cloud.js
Created Feb 22, 2020 — forked from borkdude/sci_google_cloud.js
Google cloud function running sci
View sci_google_cloud.js
const { evalString } = require("@borkdude/sci");
let printlnArgs = null;
function println(...args) {
printlnArgs = => arg.toString()).join(" ");
exports.evalClojureExpr = (req, res) => {
const { text } = req.body;
try {
const result = evalString(text, {namespaces: {"clojure.core": {println: println}}});
let value = [];
jeroenvandijk / heredoc.clj
Created Feb 12, 2020 — forked from cgrand/heredoc.clj
An ugly hacky heredoc for Clojure
View heredoc.clj
(defn heredoc []
(let [delim (.readLine *in*)]
(->> (repeatedly #(.readLine *in*))
(take-while #(not= delim %))
(interpose \newline)
(apply str))))
; The following lines are read (by the reader) as:
; "Look )(\"\\T\na here doc!\n"