Source: https://cs.au.dk/~hosc/local/LaSC-4-3-pp223-242.pdf
Sometimes the behavior of an instance of a data type can be divided into several different “modes” of behavior or implementation…
| // Have some complicated non-React widgets that manipulate DOM? | |
| // Do they manage a list of DOM elements? Here's how to wrap it | |
| // into a React component so you can "constantly rerender" it. | |
| // A dumb non-react widget that manually manage some DOM node that | |
| // represent a list of items | |
| function NonReactWidget(node) { | |
| this.node = node; | |
| } |
| ; add to your user.clj to recover pre-1.7.0 printing of Objects and Throwables in the REPL | |
| ; https://github.com/clojure/clojure/blob/master/changes.md#17-printing-as-data | |
| (in-ns 'clojure.core) | |
| ; from 1242c48 | |
| (defn- print-object [o, ^Writer w] | |
| (when (instance? clojure.lang.IMeta o) | |
| (print-meta o w)) | |
| (.write w "#<") |
| ;; Gamma (shader-generation): https://github.com/kovasb/gamma | |
| ;; Gamma Driver (WebGL resource management, aka "Om for WebGL"): https://github.com/kovasb/gamma-driver | |
| ;; Gamma examples: https://github.com/kovasb/gamma-examples | |
| (ns gampg.learn-gamma.lesson-01 | |
| (:require [clojure.string :as s] | |
| [gamma.api :as g] | |
| [gamma.program :as p] | |
| [gamma.tools :as gt] | |
| [gamma-driver.drivers.basic :as driver] |
Source: https://cs.au.dk/~hosc/local/LaSC-4-3-pp223-242.pdf
Sometimes the behavior of an instance of a data type can be divided into several different “modes” of behavior or implementation…
| /* | |
| * based on https://gist.github.com/sebmarkbage/fac0830dbb13ccbff596 | |
| * by Sebastian Markbåge | |
| */ | |
| import React from 'react'; | |
| const noop = () => {}; | |
| const es6ify = (mixin) => { | |
| if (typeof mixin === 'function') { |
| echo "Flipping tables! (╯°□°)╯︵ ┻━┻" | |
| num_rules=3 | |
| real=3 # exposed to the ELB as port 443 | |
| test=4 # used to install test certs for domain verification | |
| health=5 # used by the ELB healthcheck | |
| blue_prefix=855 | |
| green_prefix=866 |
I've heard this before:
What I really get frustrated by is that I cannot wrap
console.*and preserve line numbers
We enabled this in Chrome DevTools via blackboxing a bit ago.
If you blackbox the script file the contains the console log wrapper, the script location shown in the console will be corrected to the original source file and line number. Click, and the full source is looking longingly into your eyes.
| var Bar1 = base => class extends base { | |
| componentWillMount(){ | |
| super.componentWillMount(); | |
| console.log('Bar1'); | |
| } | |
| }; | |
| var Bar2 = base => class extends base { | |
| componentWillMount(){ | |
| super.componentWillMount(); |
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.