jack-in into normal Clojure nREPL. Run:
(require '[cljs.repl :as repl] '[cljs.repl.node :as node])
(compile 'cljs.repl.node)
(cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env))
import { createMachine, assign } from "xstate"; | |
type MachineContext = { | |
lives: number; | |
}; | |
type MachineEvent = | |
| { type: "IDLE" } | |
| { type: "WALK" } | |
| { type: "RUN" } |
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- TeXML files must contain the Response element --> | |
<Response> | |
<!-- Say and Dial are Verbs --> | |
<Say>Thank you for calling Telnyx.</Say> | |
<Dial> | |
<Sip>sip:[email protected]</Sip> | |
</Dial> | |
</Response> |
(defn button [props _] | |
(om/component | |
(dom/button nil (:children props)))) | |
(def render-out (om/render-to-object button {:children "text"})) | |
(is (= "text" (:children render-out)) |
jack-in into normal Clojure nREPL. Run:
(require '[cljs.repl :as repl] '[cljs.repl.node :as node])
(compile 'cljs.repl.node)
(cemerick.piggieback/cljs-repl (cljs.repl.node/repl-env))
// radians->degrees | |
function degrees(radians) { | |
return radians * 180 / Math.PI; | |
} | |
// gets two positions { x: Number, y: Number } and return | |
// angle between them in radians | |
function getAngle(pos1, pos2 = {x: 0, y: 0}) { | |
let [dx, dy] = [pos1.x - pos2.x, (pos1.y - pos2.y) * -1] | |
return Math.atan2(dy, dx); |
function createReducer(handlers, initialState) { | |
return function reducer(state = initialState, action) { | |
return handlers[action.type] ? | |
handlers[action.type](state, action) | |
: state | |
} | |
} | |
const math = createReducer({ | |
INCREMENT: (state) => state + 1, |
node -e "require('repl').start({ignoreUndefined: true})" |
CSS Wizardry recently wrote a great post about styling: Contextual Styling: UI Components, Nesting, and Implementation Detail. He showed three ways to solve the problem of implementation details in a component's styles. I want to propose another way to solve this problem, one that uses composition.
The original styles of a .nav-primary
component are:
.nav-primary {
/* This is how the nav should always look: */
margin: 0;
(ns ^:figwheel-always om-tut.core | |
(:require-macros [cljs.core.async.macros :refer [go]]) | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[cljs.core.async :refer [put! chan <!]] | |
[clojure.data :as data] | |
[clojure.string :as string])) | |
(enable-console-print!) |
Source: https://crashingdaily.wordpress.com/2008/03/06/diff-two-stdout-streams/
You can diff
two commands stdout without creating two files. <( ... )
command creates a temporary file with the stdout of the command inside it.
Example:
diff -B <( ls -1 / ) <( ls -1 ~ )