Skip to content

Instantly share code, notes, and snippets.

stevebuik / cli-gist.clj
Last active June 28, 2022 08:50
An example of "light" validation of babashka.cli arguments i.e. checking for required arguments without using Spec or Malli
View cli-gist.clj
(ns cli-gist
(:require [babashka.cli :as cli]
[clojure.set :as set]
[clojure.string :as str]))
(def upload-spec {:bucket-region {:ref "<aws-region>"
:desc "The AWS region where the S3 bucket was created"
:optional true
:alias :r}
stevebuik / recursive-multi-malli.clj
Last active December 27, 2020 06:21
example of Malli tree nodes using a :multi for the nodes
View recursive-multi-malli.clj
(ns recursive-multi-malli
(:require [malli.core :as m]
[malli.util :as mu]
[malli.error :as me]
[criterium.core :as criterium]))
(def simple-tree-node
[:schema {:registry {::type [:enum :blue :green]
::children [:vector [:ref ::node]]
::node [:multi {:dispatch :type}
stevebuik / recursive-malli-perf.clj
Created December 26, 2020 02:21
slow recursive validation in Malli
View recursive-malli-perf.clj
(ns recursive-malli-perf
(:require [malli.core :as m]
[criterium.core :as criterium]))
(def simple-node
[:name string?]])
(def simple-tree-node
[:and simple-node
stevebuik / gist:e289d6783b43639726cbc39357728bbf
Created May 21, 2020 07:09
lacinia optional string params in mutations
View gist:e289d6783b43639726cbc39357728bbf
(ns tools.graphql-fiddle
(:require [clojure.pprint :refer [pprint]]
[com.walmartlabs.lacinia.schema :as schema]
[com.walmartlabs.lacinia.util :refer [attach-resolvers]]
[com.walmartlabs.lacinia :as lacinia]))
(def definition
{:objects {:person {:fields {:name '{:type String}
:nicknames '{:type (list String)}}}
:saveResult {:fields {:status '{:type String}}}}

Keybase proof

I hereby claim:

  • I am stevebuik on github.
  • I am beechhouses ( on keybase.
  • I have a public key ASD09p9I5oo2CA7Yos0DGyreoRyJrpE53h-09XoS39YebQo

To claim this, I am signing this object:

View ion-release.clj
(defn release
"Do push and deploy of app. Supports stable and unstable releases. Returns when deploy finishes running."
(println "Pushing..")
(let [push-data (ion-dev/push args)
deploy-args (merge (select-keys args [:creds-profile :region :uname])
(select-keys push-data [:rev])
{:group group})]
(println "Deploying..")
View components.datomic.core-test.clj
(ns components.datomic.core-test
[clojure.pprint :refer [pprint]]
[clojure.test :refer :all]
[datomic.client.api :as d]
[datomic.client.api.impl :as di]
[datomic.api :as db-free])
(:import (java.util UUID)))
(declare test-conn)
stevebuik / terse.clj
Created June 25, 2017 07:37
terse datomic schema vectors. based on ideas from this presentation at clj-syd
View terse.clj
(require '[clojure.pprint :refer [pprint]])
(require '[datomic.api :as d])
(require '[clojure.spec :as s])
(require '[clojure.spec.test :as st])
(s/def ::optional-attributes (s/* (s/alt :db/fulltext (s/and (partial = :fulltext)
; conformer should be last so that it returns the transformed value
(s/conformer (constantly true)))
:db/index (s/and (partial = :index)
(s/conformer (constantly true)))
stevebuik / gist:665511e028295f422ce21f2596b77c3a
Created October 11, 2016 08:41
recursive denormalization bug?
View gist:665511e028295f422ce21f2596b77c3a
(require '[ :as om])
(require '[clojure.pprint :refer [pprint]])
(def initial-state
{:root {:id 1
:name "root"
:type :branch
:children [{:id 2
:type :leaf
:name "first child"}
View dali-sample
{:direction :down, :anchor :center, :gap 25, :position [100 100]}
{:direction :right, :anchor :left, :gap 25}