Skip to content

Instantly share code, notes, and snippets.

View jacobobryant's full-sized avatar

Jacob O'Bryant jacobobryant

View GitHub Profile
jacobobryant / init.vim
Created January 13, 2024 20:40
neovim config as of jan 2024
call plug#begin()
function! DoRemote(arg)
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'guns/vim-sexp'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
jacobobryant /
Created December 9, 2023 00:21
How to make cider use `bb dev` to start the REPL

Put this in .dir-locals.el:

((nil . ((cider-preferred-build-tool . babashka)
         (cider-babashka-parameters . "dev"))))
jacobobryant /
Created December 3, 2023 07:11
Notes on default logging in Biff

Thanks to @olavfosse for writing this up:

The logging architecture of our aplication looks like this. The leftmost nodes are user-facing logging APIs. They all hand their logs over to slf4j, which in turns hand them over to slf4j-simple, which prints them. -\

jacobobryant / app.js
Created June 14, 2023 19:35
Some javascript code I use for rendering emails in Yakread
// This assumes you have an element like <div id="post-content" data-contents="..."></div>,
// where data-contents has the html you'd like to render. Then call renderPost().
function $(selector) {
return document.querySelector(selector);
function renderPost() {
let element = $("#post-content");
let html = element.getAttribute('data-contents');
jacobobryant /
Last active April 13, 2024 16:37
How to add a toggle button for dark mode with Biff and Tailwind

How to add a toggle button for dark mode with Biff and Tailwind

By default, Tailwind's dark mode classes will take effect automatically if the user's operating system is already set to dark mode. Follow these instructions if you would also like to provide a toggle button so the user can override the operating system setting.

Set darkMode: 'class' in tailwind.config.js:

jacobobryant / deps.edn
Created April 18, 2023 17:16
Get # of unique slack channel participants per month
{:deps {clj-http/clj-http {:mvn/version "3.12.3"}
org.jsoup/jsoup {:mvn/version "1.11.3"}}}
jacobobryant / dashboard.clj
Last active December 16, 2023 15:17
Internal dashboard code being used in
(:require [com.biffweb :as biff]
[clojure.string :as str]
[cheshire.core :as cheshire]))
(defn debug [x]
[:pre (with-out-str (biff/pprint x))])
;; slight modification of clojure.core/distinct
(defn distinct-by
jacobobryant /
Last active December 9, 2023 00:24
How to let users upload images to S3 with Biff

How to let users upload images to S3 with Biff

UPDATE: Biff now includes a com.biffweb/s3-request function that can be used with the examples below, with some slight modifications.

Add the provided s3.clj file to your project, and set the following keys in config.edn and secrets.env:

;; config.edn
:s3/origin ""
:s3/edge ""
jacobobryant / juice.js
Last active February 25, 2023 02:08
Some JS functions used in Yakread
// A serverless function for Readability that I'm currently using
let juice = require('juice');
function main(opts) {
let html = juice(opts['html'], { webResources: { images: false } });
return { body: { html } };
exports.main = main;
jacobobryant / Dockerfile
Created December 18, 2022 01:30
Dockerfile for deploying Biff on
from clojure:temurin-17-tools-deps-bullseye
ENV BB_COMMIT=965c177bca31ae9882c975ef7db448e12f59984e
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
RUN curl$TRENCH_VERSION/trenchman_${TRENCH_VERSION}_linux_amd64.tar.gz \