Skip to content

Instantly share code, notes, and snippets.

@blasut
blasut / machine.js
Last active May 12, 2020 12:58
Generated by XState Viz: https://xstate.js.org/viz
const fetchCreditCheck = (context, event) => new Promise((resolve, reject) => {
console.log("fetch credit check")
return resolve({
status: "APPROVED"
})
});
const fetchBankIdStatus = (context, event) => new Promise((resolve, reject) => {
console.log("fetch bankid status")
return resolve({
(ns playingwithsyntax.core)
;; We can define our own 'reader', which says that <> are waaay coler than Sexps.
;; We "bottom" out to clojure, so we parse the <>-exp and return a sexp that clojure understands.
;; To support list literals we can return a quoted list from read.
(comment
;; This is useful for stepping through the my-read function
(def string-to-read "(+ 1 1)")
(def string-to-read "<+ 1 1>"))
@blasut
blasut / spec.cljs
Created May 26, 2017 09:38 — forked from swannodette/spec.cljs
om.next query spec
(ns om.next.spec
(:require [cljs.spec :as s]))
(s/def ::ident (s/and vector? (s/cat :ident keyword? :value #(not (coll? %)))))
(s/def ::join-key (s/or :prop keyword? :ident ::ident))
(s/def ::join (s/and (s/map-of ::join-key ::query) #(= (count %) 1)))
(s/def ::union (s/and (s/map-of keyword? ::query) #(> (count %) 1)))
(s/def ::param-expr
(s/cat :query-expr ::query-expr