First, a few dependencies:
- Leiningen: https://leiningen.org/
- Node.js & NPM: https://nodejs.org/
- Serverless: https://serverless.com/
- An active AWS account: https://aws.amazon.com/
(ns helix.util.html) | |
(require | |
'[clojure.data.xml :as xml] | |
'[clojure.walk :as walk]) | |
(import '[clojure.data.xml Element]) | |
(defn html->dom |
/** | |
* Making promises | |
*/ | |
let okPromise = Js.Promise.make((~resolve, ~reject as _) => [@bs] resolve("ok")); | |
/* Simpler promise creation for static values */ | |
Js.Promise.resolve("easy"); | |
Js.Promise.reject(Invalid_argument("too easy")); |
#!/usr/bin/env bash | |
current_dir=$(pwd) | |
# make directory to hold node_modules | |
read -ra hash <<< "$(pwd | shasum)" # get hash of current path | |
modules_dir="$HOME/.nbb/_modules/${hash[0]}" | |
mkdir -p "$modules_dir" | |
# install node_modules |
Skeletyl self source cost | |
5x each PCB from JLCPCB: 33.46 + 20.13 = 53.59 | |
Digikey | |
Flex strips x 30 = 47.48 | |
Diode x 100 = 17.70 | |
Neopixel LED x 70 = 20.65 | |
330 Ohm resistor x 20 = 2.66 |
;; An example usage of an imaginary `iteration-async` API, which uses | |
;; continuation passing to signal when to continue to the next page, | |
;; completion, and failure | |
(defn fetch-pages-async | |
"Fetches summary pages repeatedly until no pages are left. | |
Calls `done` callback when complete. Calls `err` if an error occurs." | |
([done err url] | |
(fetch-summaries done err url 0)) | |
([done err url page] |
(ns lilactown.template | |
#?(:cljs (:require-macros [lilactown.template]))) | |
(defn- interleave* | |
"A version of interleave that continues to build the lazy seq even if one of | |
the coll has no elements left" | |
([] ()) | |
([c1] (lazy-seq c1)) | |
([c1 c2] |
function useCutoff(x, cutoff) { | |
// track each value of x between renders | |
let xPrev = useRef(x); | |
useEffect(() => { xPrev.current = x }, [x]); | |
// if the cutoff function returns true, render the previously returned value. | |
// else, synchronously schedule render withnew state value | |
let [ret, setRet] = useState(x); | |
if (!cutoff(xPrev.current, x)) { | |
setRet(x) |
(ns eff.global-scope | |
(:import | |
(java.lang Continuation ContinuationScope))) | |
(let [effect-scope (ContinuationScope. "effect") | |
state (atom 0) | |
;; track what effect is currently being performed, | |
;; and what we're going to return | |
effect-performing (atom nil) | |
effect-returning (atom nil) |
First, a few dependencies:
(ns helix-three.core | |
(:require [goog.object :as gobj] | |
[helix.core :refer [defnc $]] | |
[helix.hooks :as hooks] | |
[cljs-bean.core :as b] | |
["react-dom" :as rdom] | |
["react-three-fiber" :as rtf]) | |
(:refer-clojure :exclude [Box])) | |
(defnc Box [props] |