Skip to content

Instantly share code, notes, and snippets.

Avatar
🌊
Do not follow in the footsteps of the sages. Seek what they sought.

Will Acton lilactown

🌊
Do not follow in the footsteps of the sages. Seek what they sought.
View GitHub Profile
View helix_three_core.cljs
(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]
View helix_context_memo.cljs
(ns helix-context-memo
(:require [helix.core :refer [defnc $ <>]]
[helix.dom :as d]
[helix.hooks :as hooks]
["react-dom" :as rdom]
["react" :as react]))
(def global-state-context (react/createContext {}))
(def GlobalStateProvider (.-Provider global-state-context))
View helix_example.cljs
(ns helix-example
(:require
[helix.core :refer [defnc $ <>]]
[helix.hooks :as hooks]
[helix.dom :as d]
["react-dom" :as rdom]))
(defnc Greeting
"A component which greets a user. The user can double click on their name to edit it."
[{:keys [name on-name-change]}]
View clojure_lexer.js
import { LexicalGrammar } from "./lexer";
let toplevel = new LexicalGrammar();
export const canonicalParens = {
'#?(': '()',
'#?@(': '()',
'#(': '()',
'(': '()',
')': '()',
'#{': '{}',
'{': '{}',
View ueaq.cljs
(ns ueaq.core
(:require
[goog.object :as gobj]
["react" :as r]
["react-dom/server" :as rds]))
(defn unwrap
[^js p]
(.-__unwrap p))
View apollo-react.cljs
(ns apollo-example.core
(:require [hx.react :as hx :refer [defnc]]
["react-dom" :as rdom]
["react-apollo" :as apollo]
["apollo-boost" :default ApolloClient :refer [gql]]
[applied-science.js-interop :as j]))
(def client (ApolloClient. #js {:uri "https://48p1r2roz4.sse.codesandbox.io"}))
(def exchange-query (gql "{
View gist:0b9a0e0551e320859cc2e509a58410f8
commit "6ccb629e365f46a9516e4defeced652cce9d4d35"
shadow-cljs - config: /Users/will/Code/clojure/hx/shadow-cljs.edn cli version: 2.7.9 node: v10.3.0
shadow-cljs - socket connect failed, server process dead?
shadow-cljs - starting via "clojure"
Dec 14, 2018 5:17:21 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.3.8.Final
Dec 14, 2018 5:17:21 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.3.8.Final
shadow-cljs - HTTP server for :workshop available at http://localhost:8700
View install-rust.sh
# Install rustup from https://rustup.rs/
rustup toolchain add nightly # install nightly
cargo +nightly install racer # install racer
rustup component add rustfmt-preview # install rustfmt
rustup component add rust-src # install rust source
@lilactown
lilactown / hooks-indirect.js
Last active Nov 6, 2018
Reconciler-agnostic React hooks
View hooks-indirect.js
/**
Problem 1: As a library developer, I want to be able to test my hooks without having to render a component.
Problem 2: As a library developer, I want to be able to publish my hooks without a direct dependency on React.
Problem 3: As an application developer, I want to be able to easily override (with some sort of proxy/rewire magic,
perhaps) hooks with side effects in tests.
Problem 4: As an application developer, I would like to be able to use hooks written for React in other frameworks
that support hooks.
@lilactown
lilactown / rebel.sh
Last active Jun 18, 2019
Start a Clojure(Script) REPL with rebel-readline and any other dependencies you want to include
View rebel.sh
# Add these to your .bash_profile / .zshrc / etc.
# Starts a Clojure repl
function rebel-clj() {
clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"} $@}}" -m rebel-readline.main
}
# Starts a browser REPL
function rebel-cljs() {
clojure -Sdeps "{:deps {com.bhauman/figwheel-main {:mvn/version \"0.1.7\"} com.bhauman/rebel-readline-cljs {:mvn/version \"0.1.4\"} $@}}" -m figwheel.main
You can’t perform that action at this time.