- plain ol' React
let state = initial
render(view(state), element)
view
is pure!
#!/bin/sh | |
# Works with merlin version 2.5.4. Using protocol described at | |
# https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking | |
usage () | |
{ | |
echo | |
echo Generate a signature for a Bucklescript module. | |
echo |
#!/usr/bin/env sh | |
# Works with merlin version 2.5.4. Using protocol described at | |
# https://github.com/ocaml/merlin/blob/master/doc/dev/OLD-PROTOCOL.md#type-checking | |
usage () | |
{ | |
echo Usage: either of the following will work: | |
echo | |
echo ' sig module.ml' |
# open the current folder in Finder's tab | |
function oft() { | |
local folder_name=$1 | |
if ! [[ -d $1 ]]; then | |
# it is a file, get the enclosing folder | |
folder_name="$(dirname "$1")" | |
fi | |
# if no arguments are given, we use the current folder |
"The common wisdom of "don't use conditionals in shaders" is one of my biggest frustrations with how shaders are taught. | |
step(y, x) _is_ a conditional! It compiles to identical code as: | |
float val = (x >= y ? 1.0 : 0.0) | |
or | |
float val = 0.0; | |
if (x >= y) val = 1.0;" | |
https://twitter.com/bgolus/status/1235254923819802626 | |
// Performing shader divisions without diving *rcp = approximation of 1/x | |
float myDividedVal = myValToDivide * rcp(myDivider); |
#!/usr/bin/env bash | |
# Instructions. You need: | |
# - a working opam environment | |
# - an opam file in your current directory (to describe your project) | |
# - possibly some packages path-pinned in the current switch | |
# | |
# Run the scripts, and then check the contents of sources/ | |
set -eu |
These use separate document structures instead of HTML, some are more modular libraries than full editors
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.
elem.offsetLeft
, elem.offsetTop
, elem.offsetWidth
, elem.offsetHeight
, elem.offsetParent
setProps - depends on reading the last reconciled props from the current reconciled state of the app, at the time of the call. It also depends on an object that doesn't necessarily need to be there outside reconciliation. This is unlike setState, which is state that needs to be there. setState is queued up and merged at the time of reconciliation. Not at the time of the call. setState has a side-effect but is not a stateful nor mutative API.
isMounted - reads the current state of the tree, which may be stale if you're in a batch or reconciliation.
getDOMNode/findDOMNode - Reads the currently flushed node. This currently relies on the state of the system and that everything has flushed at this time. We could potentially do a forced render but that would still rely on the state of the system allowing us to synchronously being able to force a rerender of the system. Note: in 0.14, refs directly to DOM node will resolve to the DOM node. This allow you to get access to a node at the time of its choos
// lein cljsbuild once release | |
// d8 node_modules/immutable/dist/immutable.min.js mori.bare.js ./bench/mut_perf.js | |
// jsc node_modules/immutable/dist/immutable.min.js mori.bare.js ./bench/mut_perf.js | |
;(function() { | |
function sum(a,b) { | |
return a+b; | |
} |