Skip to content

Instantly share code, notes, and snippets.

💭
Freaking cold in Montreal. Ready for spring bigtime.

Bruce Hauman bhauman

View GitHub Profile
@bhauman
bhauman / Basic_Figwheel_Main_Example.md
Last active Oct 3, 2018
Base Figwheel Main example
View Basic_Figwheel_Main_Example.md

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
View figwheel-simple.cljc
(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 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
bhauman / CLJS-REPLThreadIterrupt.patch
Created Feb 10, 2017
demonstrating where to place thread/interupted
View CLJS-REPLThreadIterrupt.patch
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 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) {
@bhauman
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
(: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 {}))
View figwheel_client_socket_repl.clj
(require 'tubular.core)
(tubular.core/connect "127.0.0.1" REPL_PORT)
@bhauman
bhauman / An_Explanation.md
Last active Apr 27, 2016
common cljs build format ideas
View An_Explanation.md

A common build configuration format that all ClojureScript tools can consume

@bhauman
bhauman / reagent_errors.cljs
Created Oct 17, 2015
Fixing reagent errors
View reagent_errors.cljs
(ns devdemos.reagent-errors
(:require
[reagent.interop :refer-macros [.' .!]]
[reagent.core :as reagent]
[reagent.impl.component :as comp]
[sablono.core :as sab :include-macros true])
(:require-macros
[cljs-react-reload.core :refer [defonce-react-class]]
[devcards.core :as dc :refer [defcard deftest]]))
View project.clj
:profiles { :dev { :dependencies [[com.cemerick/piggieback "0.2.1"]
#_[org.clojure/tools.nrepl "0.2.10"]]
:plugins [[refactor-nrepl "1.1.0"]
[cider/cider-nrepl "0.9.1"]]}}
:figwheel {
:http-server-root "public" ;; default and assumes "resources"
:server-port 3449 ;; default
:css-dirs ["resources/public/css"]
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.