Skip to content

Instantly share code, notes, and snippets.

View DaveWM's full-sized avatar

David Martin DaveWM

View GitHub Profile
@DaveWM
DaveWM / def-let-bindings.clj
Created July 4, 2021 12:07
A Cursive REPL command to `def` multiple let bindings. Supports all forms of let bindings.
(->> (macroexpand '(let [~selection]))
second
(partition 2)
(map (fn [[sym val]]
(intern *ns* sym (eval val)))))
@DaveWM
DaveWM / SketchSystems.spec
Last active May 12, 2021 15:55
SalesForce Requests
SalesForce Requests
HTTP Call
success -> Success
400 response -> Exception
404 response -> Exception
401 response -> Refresh Token
other failure -> Wait
Refresh Token
token received -> HTTP Call
Wait
#!/usr/bin/env bb
;; ^^ this tells our shell to use Babashka to run this script
;; read the file path of our CSV and the key field from the command line args
(def csv-file-path (first *command-line-args*))
(def key-field (second *command-line-args*))
;; read the CSV line-by-line into a data structure
(def csv-data
(with-open [reader (io/reader csv-file-path)]
@DaveWM
DaveWM / datomic-update-cardinality-many-attr.clj
Created November 21, 2019 17:17
Datomic - update cardinality many attr
(ns datomic-update-cardinality-many
(:require [datomic.api :as d]))
(defn update-attr-txs [db entity-id attr values]
(let [current-vals (-> (d/q '[:find [?p ...]
:where [?id :intention/parents ?p]
:in $ ?id]
db
entity-id)
(set))
Loan
Non-existent
origination -> Payable
Payable
Current
payment time elapses -> Delinquent
full term reached -> End of Term
Delinquent
insufficient payment -> Delinquent
defaulted -> Default
@DaveWM
DaveWM / rollup.config.js
Created January 5, 2017 15:58
Rollup CommonJS bug
import commonjs from 'rollup-plugin-commonjs';
export default {
entry: 'test.js',
format: 'iife',
moduleName: 'main',
plugins: [
commonjs({
include: 'x.js'
})