Skip to content

Instantly share code, notes, and snippets.

View PEZ's full-sized avatar
🎯
Focusing

Peter Strömberg PEZ

🎯
Focusing
View GitHub Profile
@PEZ
PEZ / highlight_thousands.cljs
Last active October 30, 2024 04:51
A highlighter for long numbers in VS Code, using Joyride
;; Joyride thousands highlighter
;; The end goal here is to help humans read long numbers by highlighting groups of thousands
;; First we need to find the groups of thousands. We only want to highlight _odd_ groups
;; of thousands, starting with the least significant group to the most significant group.
;; We also consider the most significant group of thousands when it is not three digits long.
; Here is some test data, line numbers are on the left
; The xxx are the groups of thousands we want to highlight on the numbers on the line above them.
;08 1111111222111333444 :foo 555666 :bar 123 :baz 1234
;09 x xxx xxx xxx xxx xxx
@PEZ
PEZ / repl_fiddle.clj
Last active October 9, 2024 21:41
Learn Datalog Today REPL Fiddle
(ns learndatalogtoday.repl-fiddle
(:require [learndatalogtoday.handler :as handler]
[datomic.client.api :as d]))
(defn exercise-chapter [n]
(reduce (fn [acc {:keys [question inputs :as exercise]}]
(conj acc [(count acc)
question ((fn [[query & args]]
(list 'comment
(apply list
@PEZ
PEZ / dumdom_defcomponent_macro.clj
Created February 18, 2024 09:37
A workaround to make default linting resolve `dumdom.core/defcomponent` without complaints.
(ns my-dumdom.macros
(:require [dumdom.core :as dumdom]))
(defn- extract-docstr
[[docstr? & forms]]
(if (string? docstr?)
[docstr? forms]
["" (cons docstr? forms)]))
(defn- extract-opts
@PEZ
PEZ / config.edn
Created February 18, 2024 08:06
A clj-kondo hook for Dumdom components `.clj-kondo/hooks/dumdom.clj`
{:linters {:dumdom/component-options {:level :warning}}
:hooks {:analyze-call {dumdom.core/defcomponent hooks.dumdom/defcomponent}}}
@PEZ
PEZ / starship.toml
Last active May 27, 2023 12:06
A mainly git focused starship config
# The longest config I have ever written to get something minimal.
# I only want:
# 1. an unabberiviated path
# 2. the git branch, status, commit, state
# 3. The newline.
# Rationale for this approach:
# I like a lot of the default format, so don't want to override it by default.
[directory]
disabled=false
@PEZ
PEZ / long-classpath-string.txt
Last active January 18, 2023 21:05
VS Code lookahead regex match mystery
"env/dev/clj:env/dev/cljs:env/dev/resources:test/clj:test/cljs:env/test/resources:src/clj:src/cljs:src/cljc:resources:/Users/pez/.m2/repository/binaryage/devtools/1.0.6/devtools-1.0.6.jar:/Users/pez/.m2/repository/breaking-point/breaking-point/0.1.2/breaking-point-0.1.2.jar:/Users/pez/.m2/repository/buddy/buddy-hashers/1.8.158/buddy-hashers-1.8.158.jar:/Users/pez/.m2/repository/camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar:/Users/pez/.m2/repository/cider/cider-nrepl/0.28.5/cider-nrepl-0.28.5.jar:/Users/pez/.m2/repository/clj-http/clj-http/3.12.3/clj-http-3.12.3.jar:/Users/pez/.m2/repository/clj-statecharts/clj-statecharts/0.1.5/clj-statecharts-0.1.5.jar:/Users/pez/.m2/repository/clj-time/clj-time/0.15.2/clj-time-0.15.2.jar:/Users/pez/.m2/repository/clout/clout/2.2.1/clout-2.2.1.jar:/Users/pez/.m2/repository/com/github/seancorfield/honeysql/2.2.891/honeysql-2.2.891.jar:/Users/pez/.m2/repository/com/taoensso/nippy/3.1.3/nippy-3.1.3.jar:/Users/pez/.m2/repository/com/taoensso/tempura/1.3.0
flf2a$ 6 4 6 -1 4
3x5 font by Richard Kirk (rak@crosfield.co.uk).
Ported to figlet, and slightly changed (without permission :-})
by Daniel Cabeza Gras (bardo@dia.fi.upm.es)
@
@
@
@
@
@PEZ
PEZ / rebob - rebase branch on branch
Last active March 10, 2022 17:18
Zsh functions to help rebasing git branches safely
# Previous branch is `baz`
~/Foo(bar|✔) % rebobl -
logging to: /var/folders/t5/gqxhj8pd6p9_tnvy6sbtmy480000gn/T/rebob.YJJZirAY
rebob: No branch given, checking REBOBS in /Users/pez/.my-configs/rebob_config.zshrc
rebob: rebob /Users/pez/Foo:bar on -
rebob: pulling?: false
rebob: Created: .rebobing
Saved working directory and index state WIP on bar: 17fa37c Add baz
rebob: Stashed -u (.rebobing stashed)
Current branch bar is up to date.
"paste-replaced.replacers": [
[ // hostname/path -> Markdown url
[".*", "[$&](https://$&)"],
],
[ // Clojure namespace -> file path segment
["\\.", "/", "g"],
["-", "_", "g"],
],
[ // Love bomb, anything -> 💪♥️♥️♥️♥️♥️♥️💪
[".", "♥️", "g"],
@PEZ
PEZ / rich4clojure_elementary_problem_005.clj
Last active October 12, 2024 21:42
Lists: conj – Rich 4Clojure Problem 5 – See: https://github.com/PEZ/rich4clojure
(ns rich4clojure.elementary.problem-005
(:require [hyperfiddle.rcf :refer [tests]]))
;; = Lists: conj =
;; By 4Clojure user: dbyrne
;; Difficulty: Elementary
;;
;; When operating on a list, the conj function will return
;; a new list with one or more items "added" to the front.
;;