Skip to content

Instantly share code, notes, and snippets.

View aroemers's full-sized avatar
🧱
Always Be Composing

Arnout Roemers aroemers

🧱
Always Be Composing
View GitHub Profile
@aroemers
aroemers / ReaderBuffer.java
Created April 4, 2023 10:09
A buffering Reader wrapper, implementing CharSequence, suitable for regex.Pattern matching
import java.io.IOException;
import java.io.Reader;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ReaderBuffer implements CharSequence {
private StringBuilder buffer;
private Reader reader;
@aroemers
aroemers / core.clj
Last active October 4, 2022 13:41
Crustimoney 2
;;;; Implementation based on
;;;; https://blog.bruce-hill.com/packrat-parsing-from-scratch
(ns crustimoney2.core
(:require [clojure.string :as str]))
;;; Utils
(defn success? [o]
(and (map? o) o))
@aroemers
aroemers / .gitignore
Last active December 18, 2021 23:31
Tailwind CLI wrapper script
/.tailwind
@aroemers
aroemers / app.clj
Last active January 15, 2021 20:25
Component-lite
(ns app
(:require [lifecycle :refer [combine parallel]]))
(defn components [app-config]
(combine (parallel (users-db/component)
(tasks-db/component))
(rest-api/component app-config)))
### Keybase proof
I hereby claim:
* I am aroemers on github.
* I am arnout (https://keybase.io/arnout) on keybase.
* I have a public key ASC4xD3JS7DlI8pTW3DC9pVRfVpXu6jHLyjyjzX-Xznutwo
To claim this, I am signing this object:
@aroemers
aroemers / stateful_session.clj
Created November 2, 2016 12:32
Stateful session in pedestal
(ns stateful-session
(:refer-clojure :exclude (get)))
(def ^:dynamic *session*)
(def stateful-session
{:name ::stateful-session
:enter
(fn [context]
(let [old-value (get-in context [:request :session] {})]