Skip to content

Instantly share code, notes, and snippets.

View jack-r-warren's full-sized avatar

Jack Warren jack-r-warren

View GitHub Profile
sequenceDiagram
  autonumber
  participant User
  participant Web Client
  participant Oauth Server
  participant Oauth Proxy Function
  participant API Server
  API Server->>User: On initial load, obtain client_id from /configuration
  User->>Web Client: User login to application
~/src/terra-cli on main !2 ······················································································· at 01:43:55 PM
❯ source tools/local-dev.sh
Building Java code
> Task :clean
> Task :spotlessInternalRegisterDependencies
> Task :spotlessJava
> Task :spotlessJavaApply
> Task :spotlessApply
> Task :compileJava
(defn lev [s t]
"Calculates Levenshtein distance for S and T.
Time complexity is O(|s|*|t|); space complexity is O(|s|).
Uses the swapping two-row method to avoid exponential time, see
https://en.wikipedia.org/wiki/Levenshtein_distance#Iterative_with_two_matrix_rows"
(let [s-array (char-array s)
t-array (char-array t)
s-length (count s-array)
t-length (count t-array)]
(loop [i 0
@jack-r-warren
jack-r-warren / misc.clj
Created July 14, 2020 16:35
cond-some*: a combination of Clojure's cond, if-some, and some common if-let* implementations online.
(defmacro cond-some*
"A combination of cond, if-some, and some common if-let* implementations online.
Behaves like cond except the predicate is some number of bindings which are
available in the second part. Example:
(cond-some*
[my-var-1 true my-var-2 nil] (println \"Won't reach here, any binding to nil
makes the predicate false\")
[a 2 b 3 c false] (println (+ a b)) ;; 5 is printed because false is still
;; non-nil so the predicate is true

Keybase proof

I hereby claim:

  • I am jack-r-warren on github.
  • I am jackwarren (https://keybase.io/jackwarren) on keybase.
  • I have a public key ASBmTCkSyAlL799siC_z9SeQhNy5M8KOByFf__mL1feoiAo

To claim this, I am signing this object: