Skip to content

Instantly share code, notes, and snippets.

Avatar

David Martin DaveWM

View GitHub Profile
@DaveWM
DaveWM / def-let-bindings.clj
Created Jul 4, 2021
A Cursive REPL command to `def` multiple let bindings. Supports all forms of let bindings.
View def-let-bindings.clj
(->> (macroexpand '(let [~selection]))
second
(partition 2)
(map (fn [[sym val]]
(intern *ns* sym (eval val)))))
@DaveWM
DaveWM / SketchSystems.spec
Last active May 12, 2021
SalesForce Requests
View SketchSystems.spec
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
View csv-to-kafka.clj
#!/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 Nov 21, 2019
Datomic - update cardinality many attr
View datomic-update-cardinality-many-attr.clj
(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))
View SketchSystems.spec
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 Jan 5, 2017
Rollup CommonJS bug
View rollup.config.js
import commonjs from 'rollup-plugin-commonjs';
export default {
entry: 'test.js',
format: 'iife',
moduleName: 'main',
plugins: [
commonjs({
include: 'x.js'
})