Skip to content

Instantly share code, notes, and snippets.

Avatar

blasut

  • Stockholm, Sweden
View GitHub Profile
View machine.js
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({
View literal lists plx.clj
(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 — forked from swannodette/spec.cljs
om.next query spec
View spec.cljs
(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
You can’t perform that action at this time.