Skip to content

Instantly share code, notes, and snippets.

@stevebuik
stevebuik / cli-gist.clj
Last active Jun 28, 2022
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
stevebuik / recursive-multi-malli.clj
Last active Dec 27, 2020
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
stevebuik / recursive-malli-perf.clj
Created Dec 26, 2020
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
[:map
[:name string?]])
(def simple-tree-node
[:and simple-node
@stevebuik
stevebuik / gist:e289d6783b43639726cbc39357728bbf
Created May 21, 2020
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}}}}
View keybase.md

Keybase proof

I hereby claim:

  • I am stevebuik on github.
  • I am beechhouses (https://keybase.io/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."
[args]
(try
(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
(:require
[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
stevebuik / terse.clj
Created Jun 25, 2017
terse datomic schema vectors. based on ideas from this presentation at clj-syd https://boogler.gitbooks.io/data-macros/content/
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)))
View gist:665511e028295f422ce21f2596b77c3a
(require '[om.next :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
[:dali/page
[:dali/stack
{:direction :down, :anchor :center, :gap 25, :position [100 100]}
[:dali/stack
{:direction :right, :anchor :left, :gap 25}
[:g
{}
[:dali/align