This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns rafting | |
(:require [clojure.tools.logging :as log]) | |
(:import java.lang.AutoCloseable | |
(java.util.concurrent CompletableFuture Executors TimeUnit))) | |
(defn new-timeout-ms [] | |
(+ (System/currentTimeMillis) | |
200 | |
(rand-int 150))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [bytes (with-open [os (java.io.ByteArrayOutputStream.) | |
oos (java.io.ObjectOutputStream. os)] | |
(.writeObject oos false) | |
(.toByteArray os))] | |
(with-open [is (java.io.ByteArrayInputStream. bytes)] | |
(if (.readObject (java.io.ObjectInputStream. is)) | |
:truthy | |
:falsy))) ; => :truthy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clojure-agent-send-off-pool-3" #24 prio=5 os_prio=0 tid=0x00007f270800b000 nid=0xea3 runnable [0x00007f270eabf000] | |
java.lang.Thread.State: RUNNABLE | |
at clojure.lang.Numbers$LongOps.lt(Numbers.java:521) | |
at clojure.lang.Numbers.gt(Numbers.java:229) | |
at mranderson046.toolsreader.v0v10v0_alpha3.clojure.tools.reader.reader_types.StringReader.read_char(reader_types.clj:51) | |
at mranderson046.toolsreader.v0v10v0_alpha3.clojure.tools.reader.reader_types.PushbackReader.read_char(reader_types.clj:86) | |
at mranderson046.toolsreader.v0v10v0_alpha3.clojure.tools.reader.edn$read_token.invoke(edn.clj:60) | |
at mranderson046.toolsreader.v0v10v0_alpha3.clojure.tools.reader.edn$read_token.invoke(edn.clj:41) | |
at mranderson046.toolsreader.v0v10v0_alpha3.clojure.tools.reader.edn$read_symbol.invoke(edn.clj:241) | |
at mranderson046.toolsreader.v0v10v0_alpha3.clojure.tools.reader.edn$read.invoke(edn.clj:373) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn child-1 [!cnt] | |
(let [cnt @!cnt] | |
(prn "child-1-mount") | |
(fn [!cnt] | |
(prn "child-1-render") | |
[:div | |
"child-1"]))) | |
(defn parent-component [] | |
(let [!count (r/atom 0)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am jarohen on github. | |
* I am jarohen (https://keybase.io/jarohen) on keybase. | |
* I have a public key whose fingerprint is 091B 87FA 0F5D AE6F 0331 D013 956F 20CA 2105 F582 | |
To claim this, I am signing this object: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(comment | |
;; Option 1 - the 'fn staircase' (current) | |
(defn make-system [latch] | |
(with-db-pool {...} | |
(fn [db-pool] | |
(let [web-config (read-config ...)] | |
(with-cljs-compiler {:config web-config | |
...} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[com.stuartsierra.component :as c]) | |
(c/start-system | |
(c/system-map | |
:a (-> {:d 4} | |
(c/using {:b :b})) | |
:b (-> {:c 4} | |
(c/using {:a :a})))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; {:foo bar| | |
;; :baz quux} | |
;; | |
;; => | |
;; | |
;; {:baz quux | |
;; :foo bar|} | |
;; This is my first attempt at ELisp of a 'bigger-than-hacking-around-in-init.el' size - please be kind! | |
;; At the same time, any feedback would be really valuable! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:db {::component my-app.db/make-db-component | |
:host "host" | |
:port 5432 | |
:schema "myapp_test"} | |
:webapp {::component my-app.web/make-webapp | |
:db ::dep | |
:port 3000} | |
:phoenix/environments {"prod" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; We can write map and filter in terms of reduce | |
(defn my-map [f coll] | |
(reduce (fn [acc el] | |
(conj acc (f el))) | |
[] | |
coll)) | |
(defn my-filter [pred coll] | |
(reduce (fn [acc el] |
NewerOlder