Skip to content

Instantly share code, notes, and snippets.

View jeroenvandijk's full-sized avatar

Jeroen van Dijk jeroenvandijk

View GitHub Profile
@jeroenvandijk
jeroenvandijk / output.txt
Created December 16, 2011 16:53
[Turnip] First hack to get line number and filename of feature
Failures:
1) Initialization Init and processing of schemes schemes until none left
Failure/Error: execute_without_backtrace(*args, &block)
expected 1 items, got 0
# ./spec/acceptance/sessions.feature:75
# spec/acceptance/steps/sessions_steps.rb:27:in `block (2 levels) in <top (required)>'
# ./spec/support/turnip_hack.rb:64:in `execute_with_backtrace'
# ./spec/support/turnip_hack.rb:31:in `block (6 levels) in run'
# ./spec/support/turnip_hack.rb:28:in `each'
@jeroenvandijk
jeroenvandijk / Gemfile
Created October 17, 2011 09:29
Middleman and Rack-Offline for app manifests
gem 'rack-offline'
<!DOCTYPE html>
<html>
<body>
<canvas id="c" style="width:500px; height:500px; background-color: grey">
</canvas>
<script>
@jeroenvandijk
jeroenvandijk / malli_inline_output.clj
Created November 3, 2022 14:25
Malli inline validation printing
(ns malli.inline-output
(:require
[edamame.core :refer [parse-string]]
[malli.core :as m]
[malli.error :as me]))
;; -- helper code to find location data in an edn file
(defprotocol IUnwrap
(unwrap [_]))
@jeroenvandijk
jeroenvandijk / smart_middleware.clj
Last active February 9, 2022 16:00
An example of composing ring middleware in a more robust and intuitive way?
;; 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
jeroenvandijk / kahn_sort.clj
Last active January 20, 2022 18:16
Malli composite schema that reuses the values of the underlying values during data generation
;; Copy of https://gist.github.com/alandipert/1263783
;;
;; Copyright (c) Alan Dipert. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; 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
jeroenvandijk / com.plex.pms.plist
Created January 18, 2022 10:01 — forked from wahlmanj/com.plex.pms.plist
Plex Media center startup plist for use with launchctl
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.plex.pms</string>
<key>OnDemand</key>
<false/>
<key>ProgramArguments</key>
@jeroenvandijk
jeroenvandijk / datomic_in_memory_excision_test.clj
Last active November 11, 2021 02:36
Tests the memory usage of in-memory Datomic db when excising data
(require '[datomic.api :as d])
(def db-uri "datomic:mem://hello")
(d/create-database db-uri)
(def conn (atom {}))
(reset! conn (d/connect db-uri))
(def schema [{:db/id (d/tempid :db.part/db)
:db/ident :dummy/content
{: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 "https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive/search/" q)))
@jeroenvandijk
jeroenvandijk / sorted.clj
Last active July 3, 2020 09:02
Babashka script for sorting clojure code lines
#!/usr/bin/env bb
(doseq [line (->> (file-seq (clojure.java.io/file (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 %)))
sort
)]
(println line))