Skip to content

Instantly share code, notes, and snippets.

(ns example.touch-surface
(:require
[applied-science.js-interop :as j]
[reagent.core :as r]
[reagent.hooks :as hooks]))
(defn with-nonpassive-event-listeners
"TODO: remove this when React supports non-passive event listeners:
https://github.com/facebook/react/issues/22794
@shaunlebron
shaunlebron / safe-navigation-clojure.md
Last active November 5, 2025 21:31
Safe Navigation in Clojure

Safe Navigation in Clojure

safe-> is a safe navigation macro for Clojure. It extends some-> with additional guards:

  1. doesn’t call nil values
  2. doesn’t call missing methods (ClojureScript only)

#!/bin/bash
# Cheatsheet for remembering Bash rules for Parameter Substitution:
# https://tldp.org/LDP/abs/html/parameter-substitution.html#PSUB2
# Fallback for unset vars
# Bash #——> like JavaScript
${a+b} #——> a && b
@shaunlebron
shaunlebron / timed-functions.clj
Created March 16, 2025 03:06
setTimeout and setInterval in clojure (java)
(ns user
(:import (java.util.concurrent Executors TimeUnit)))
(defn set-timeout [^Callable f ^long ms]
(doto (Executors/newScheduledThreadPool 1)
(.schedule f ms TimeUnit/MILLISECONDS)))
(defn set-interval [^Callable f ^long ms]
(doto (Executors/newScheduledThreadPool 1)
(.scheduleAtFixedRate f 0 ms TimeUnit/MILLISECONDS)))
@shaunlebron
shaunlebron / kalshi-signing.java
Last active December 1, 2025 17:14
Kalshi signing in Java
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.Security;
import java.security.Signature;
import java.util.Base64;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.bouncycastle.openssl.PEMKeyPair;
import org.bouncycastle.openssl.PEMParser;
@shaunlebron
shaunlebron / polymarket.sign.clj
Last active June 8, 2025 23:23
Polymarket order signing in Clojure
(ns example.polymarket.sign
(:require
[cheshire.core :as json]
[clojure.string :as str])
(:import
(org.web3j.crypto Sign Credentials) ;; org.web3j/crypto "4.12.2"
(org.web3j.utils Numeric)
(java.util Base64)
(javax.crypto Mac)
(javax.crypto.spec SecretKeySpec)))
@shaunlebron
shaunlebron / polymarket-data-api-docs.md
Last active January 15, 2026 00:06
Polymarket Data API Docs
@shaunlebron
shaunlebron / css-typography.md
Last active April 13, 2024 17:07
CSS typography

CSS Typography

We can do typographic things in CSS that we couldn’t before.

Hanging Indent

text-indent: 2em hanging; /* Safari and Firefox only */