Skip to content

Instantly share code, notes, and snippets.

View rads's full-sized avatar

Radford Smith rads

View GitHub Profile
(ns -
(:require [borkdude.dynaload :refer [dynaload]]))
(defmacro doc [& args]
`(clojure.repl/doc ~@args))
(def t (dynaload 'rads.tap/vals))
(in-ns 'user)
(require '[- :refer :all])
@rads
rads / machine.js
Last active December 7, 2019 02:20
Generated by XState Viz: https://xstate.js.org/viz
// =============================================================================
// Updating the Visualization
//
// The code after this comment can be copy-pasted into the XState Visualizer:
// https://xstate.js.org/viz/
// =============================================================================
const incErrorCount = assign({ errorCount: (ctx, event) => ctx.errorCount + 1 });
const incInitCount = assign({ initCount: (ctx, event) => ctx.initCount + 1 });
const incRecoveryCount = assign({ recoveryCount: (ctx, event) => ctx.recoveryCount + 1 });
@rads
rads / machine.js
Last active December 6, 2019 22:27
Generated by XState Viz: https://xstate.js.org/viz
// =============================================================================
// Updating the Visualization
//
// The code after this comment can be copy-pasted into the XState Visualizer:
// https://xstate.js.org/viz/
// =============================================================================
const incErrorCount = assign({ errorCount: (ctx, event) => ctx.errorCount + 1 });
const incInitCount = assign({ initCount: (ctx, event) => ctx.initCount + 1 });
const incRecoveryCount = assign({ recoveryCount: (ctx, event) => ctx.recoveryCount + 1 });
@rads
rads / machine.js
Last active December 5, 2019 00:37
Generated by XState Viz: https://xstate.js.org/viz
// =============================================================================
// Updating the Visualization
//
// The code after this comment can be copy-pasted into the XState Visualizer:
// https://xstate.js.org/viz/
// =============================================================================
const incErrorCount = assign({ errorCount: (ctx, event) => ctx.errorCount + 1 });
const incInitCount = assign({ initCount: (ctx, event) => ctx.initCount + 1 });
const incRecoveryCount = assign({ recoveryCount: (ctx, event) => ctx.recoveryCount + 1 });
@rads
rads / machine.js
Created November 28, 2019 03:42
Generated by XState Viz: https://xstate.js.org/viz
function isMaxErrors(context, event) {
return context.errorCount > 2;
}
function isVersionMismatch(context, event) {
const { currentEditor } = context;
const clientEngineVersion = currentEditor && currentEditor.plugins
.get('RealTimeCollaborationClient').service._engineVersion;
@rads
rads / machine.js
Created November 28, 2019 02:27
Generated by XState Viz: https://xstate.js.org/viz
function maxErrors(context, event) {
return context.errorCount > 2;
}
function versionMismatch(context, event) {
const { currentEditor } = context;
const clientEngineVersion = currentEditor && currentEditor.plugins
.get('RealTimeCollaborationClient').service._engineVersion;
@rads
rads / machine.js
Last active November 28, 2019 02:26
Generated by XState Viz: https://xstate.js.org/viz
function maxErrors(context, event) {
return context.errorCount > 2;
}
function versionMismatch(context, event) {
const { currentEditor } = context;
const clientEngineVersion = currentEditor && currentEditor.plugins
.get('RealTimeCollaborationClient').service._engineVersion;
@rads
rads / machine.js
Last active November 27, 2019 03:28
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@rads
rads / machine.js
Created November 27, 2019 03:26
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'fetch',
// Initial state
initial: 'idle',
// States
states: {
idle: {
on: {
(set-env!
:dependencies '[[org.clojure/clojure "1.9.0-alpha15"]
[org.clojure/test.check "0.9.0"]])
(require
'[clojure.spec :as s]
'[clojure.spec.test :as stest])
(s/def ::printer fn?)