Skip to content

Instantly share code, notes, and snippets.

@bhauman
bhauman / core.cljs
Last active June 14, 2021 23:34
Generating a random ceramic tile layout for my shower in CLJS
(ns ^:figwheel-hooks tilelayout.core
(:require
[goog.dom :as gdom]
[goog.crypt.base64 :as base64]
[goog.events :as gevent]
[clojure.string :as string]
[cljs.reader :refer [read-string]])
(:import [goog History]))
;; TILE LAYOUT GENERATION
@bhauman
bhauman / keybase
Created May 3, 2019 23:33
keybase.io
### Keybase proof
I hereby claim:
* I am bhauman on github.
* I am bhauman (https://keybase.io/bhauman) on keybase.
* I have a public key ASBhQeHtmPegp3_31bd9Tlz33dt9MtLWXwjgGFugHrCAkwo
To claim this, I am signing this object:
@bhauman
bhauman / Basic_Figwheel_Main_Example.md
Last active April 30, 2022 17:16
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
bhauman / figwheel-simple.cljc
Last active July 4, 2019 14:14
simple figwheel
(ns figwheel.simple
(:require
[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]
[cljs.build.api :as bapi]
@bhauman
bhauman / ClojureScriptLoader.js
Created September 26, 2017 20:12
Loading a ClojureScript/Figwheel project with fetch instead of writing script tags.
/*
* 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
bhauman / CLJS-REPLThreadIterrupt.patch
Created February 10, 2017 16:30
demonstrating where to place thread/interupted
From: Bruce Hauman <bhauman@gmail.com>
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
bhauman / arrows.js
Last active February 6, 2017 22:10
Google Closure Stacktrace on "use strict"
"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) {
@bhauman
bhauman / compiler-options-schema.clj
Last active August 8, 2017 21:19
A Schema for ClojureScript Options
(ns cljs.compiler-options-schema
(:require
[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 {}))
(require 'tubular.core)
(tubular.core/connect "127.0.0.1" REPL_PORT)
@bhauman
bhauman / An_Explanation.md
Last active April 27, 2016 18:03
common cljs build format ideas

A common build configuration format that all ClojureScript tools can consume