Skip to content

Instantly share code, notes, and snippets.

View benknoble's full-sized avatar
💚
reproductive rights are human rights

D. Ben Knoble benknoble

💚
reproductive rights are human rights
View GitHub Profile
@benknoble
benknoble / return.rkt
Created February 2, 2022 19:25
REPL with return
#lang racket
(define-namespace-anchor this-module)
(displayln 'start)
(displayln `(repl ,(call/ec (λ (return-k)
(parameterize ([current-namespace (namespace-anchor->namespace this-module)])
(namespace-set-variable-value! 'return return-k #f (current-namespace) #t)
(read-eval-print-loop))))))
(displayln 'end)
@benknoble
benknoble / README.md
Last active September 22, 2021 19:00
Beeswax breaks when/splice in templates
  • beeswax-render-*.html produced by
raco beeswax render *.pmd
for f in {,b,c}article.html; do mv "$f" "beewswax-render-$f"; done
  • pollen-render-*.html produced by
mv pollen.rkt .pollen.rkt
raco pollen render *.pmd
@benknoble
benknoble / config.rkt
Last active June 22, 2021 21:23
using info.rkt for configuration in Racket
#lang racket
(provide (all-defined-out))
(require setup/getinfo)
(define config?-v1 (get-info/full "."))
(config?-v1 'name) ;=> "Games"
(config?-v1 'gracket-launcher-libraries) ;=> '("main.rkt")
(config?-v1 'gracket-launcher-names) ;=> '("PLT Games")
@benknoble
benknoble / parens.clj
Last active February 13, 2020 03:18
Balanced parentheses checker in a balanced parentheses language
(ns parens)
(defn mk-balanced?
"makes a balanced? checker from table, which maps closing characters to
opening characters.
see also: balanced?"
[table]
(fn [s]
(let [opens (set (vals table))
@benknoble
benknoble / Vim_autoreply.md
Last active November 23, 2022 17:41 — forked from g0xA52A2A/Vim_autoreply.md
Vim autoreply

A modified version of George's gist which I recommend checking out.

A modified version of Romain's gist which I recomend checking out.

Instead we pull the last line from the command history with ~~~histget()~~~ getcmdline() and use fullcommand() to get the command name. This gives us the proper command name which we can match against literally.

Also rather than always having to return a carriage return and whatever else in an expression I've opted to use an autocmd.

This also fixes what could be considered a minor bug at the time of writting in the original the dlist and ilist mapping. The pattern may have spaces so rather than increment the cursor backwards move it to the start then increment it forwards to the correct destination.

@benknoble
benknoble / # clisp - 2019-08-28_21-01-23.txt
Created August 29, 2019 01:13
clisp on macOS 10.14.5 - Homebrew build logs
Homebrew build logs for clisp on macOS 10.14.5
Build date: 2019-08-28 21:01:23
2019-08-14T00:13:39.8387490Z Current runner version: '2.156.4'
2019-08-14T00:13:39.8405601Z Prepare workflow directory.
2019-08-14T00:13:39.8826457Z Prepare all required actions.
2019-08-14T00:13:40.8625549Z action.yml for action: '/home/runner/work/_actions/actions/checkout/v1/action.yml'.
2019-08-14T00:13:41.0275685Z Start tracking orphan processes.
2019-08-14T00:13:41.1403114Z ##[group]Run set +e
2019-08-14T00:13:41.1476329Z set +e
2019-08-14T00:13:41.1476490Z command -v ruby
2019-08-14T00:13:41.1476643Z command -v ruby2.3.7
2019-08-14T00:13:41.1476757Z command -v ruby2.4.6
@benknoble
benknoble / 00workflow.png
Last active June 30, 2021 20:14
Workflow
00workflow.png
@benknoble
benknoble / 00tools.jpg
Last active February 23, 2024 14:29
Projects
00tools.jpg
@benknoble
benknoble / 00vimlogo.png
Last active July 29, 2022 21:01
Vim is my editor
00vimlogo.png