Skip to content

Instantly share code, notes, and snippets.

bhauman / core.cljs
Last active Jun 14, 2021
Generating a random ceramic tile layout for my shower in CLJS
View core.cljs
(ns ^:figwheel-hooks tilelayout.core
[goog.dom :as gdom]
[goog.crypt.base64 :as base64]
[ :as gevent]
[clojure.string :as string]
[cljs.reader :refer [read-string]])
(:import [goog History]))
bhauman / core.cljs
Last active Jan 28, 2021
Helpful patterns when developing with ClojureScript Figwheel and Express js
View core.cljs
(ns todo-server.core
[cljs.nodejs :as nodejs]
[figwheel.client :as fw]))
(defonce express (nodejs/require "express"))
(defonce serve-static (nodejs/require "serve-static"))
(defonce http (nodejs/require "http"))
bhauman /
Last active Nov 6, 2020
Base Figwheel Main example

Minimal Figwheel Main project

This is the base example project that is the assumed a starting point for most of the examples in the Figwheel Main documentation.

You can run it with the Clojure Tools in your terminal via:

$ clj -m figwheel.main -b dev -r
bhauman /
Last active Dec 3, 2019
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

View figwheel-simple.cljc
(ns figwheel.simple
[clojure.string :as string]
#?@(:cljs [[goog.object :as gobj]])
#?@(:clj [[clojure.walk :as walk]
[cljs.repl.browser :as brow]
[cljs.repl :as repl]
[cljs.env :as env]
[cljs.analyzer :as ana]
[ :as bapi]
View keybase
### Keybase proof
I hereby claim:
* I am bhauman on github.
* I am bhauman ( on keybase.
* I have a public key ASBhQeHtmPegp3_31bd9Tlz33dt9MtLWXwjgGFugHrCAkwo
To claim this, I am signing this object:
bhauman / ClojureScriptLoader.js
Created Sep 26, 2017
Loading a ClojureScript/Figwheel project with fetch instead of writing script tags.
View ClojureScriptLoader.js
* This script provides an example of loading a ClojureScript project
* that has been compiled using optimizations level :none.
* There are many environments that might not support the default
* method of writing script tags to load files.
* I wrote this to solve the problem of loading compiled ClojureScript
* into Chrome extentions.
bhauman / compiler-options-schema.clj
Last active Aug 8, 2017
A Schema for ClojureScript Options
View compiler-options-schema.clj
(ns cljs.compiler-options-schema
[clojure.spec :as s]
[clojure.string :as string]
;; for initial dev
[clojure.test :refer [deftest is testing]]))
(defn non-blank-string? [x] (and (string? x) (not (string/blank? x))))
(defonce ^:private registry-ref (atom {}))
bhauman / CLJS-REPLThreadIterrupt.patch
Created Feb 10, 2017
demonstrating where to place thread/interupted
View CLJS-REPLThreadIterrupt.patch
From: Bruce Hauman <>
Date: Fri, 10 Feb 2017 11:26:46 -0500
Subject: [PATCH] CLJS-ThreadIterrupt: Check for thread interuptions for
cleaner shutdown in some cases
src/main/clojure/cljs/repl.cljc | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/main/clojure/cljs/repl.cljc b/src/main/clojure/cljs/repl.cljc
bhauman / arrows.js
Last active Feb 6, 2017
Google Closure Stacktrace on "use strict"
View arrows.js
"use strict";
var position_1 = require("../../common/position");
// this value causes popover and target edges to line up on 50px targets
exports.MIN_ARROW_SPACING = 18;
function computeArrowOffset(sideLength, arrowSize, minimum) {
if (minimum === void 0) { minimum = exports.MIN_ARROW_SPACING; }
return Math.max(Math.round((sideLength - arrowSize) / 2), minimum);
exports.computeArrowOffset = computeArrowOffset;
function getPopoverTransformOrigin(position, arrowSize, targetDimensions) {