See
- https://shadow-cljs.github.io/docs/UsersGuide.html#_cursive
- https://andrearichiardi.com/blog/posts/clojurescript-cursive-shadow-setup.html
- in shadow-cljs.edn:
,,,
(ns foo | |
(:import | |
java.io.ByteArrayOutputStream | |
java.util.zip.Deflater | |
java.util.zip.DeflaterOutputStream)) | |
;; https://plantuml.com/text-encoding | |
;; https://gist.github.com/ryardley/88001f6822975ece088d41768431f5d6 | |
;; https://github.com/funcool/buddy-core/blob/b152bc77597975770c347f3bc23c8d5833237b25/src/buddy/util/deflate.clj#L28 |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<canvas id="field" width="800" height="600"></canvas> | |
<script type="application/javascript"> |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<style type="text/css"> | |
row { | |
display: block; | |
height: 5px; | |
} |
(worddiff2 | |
"yoyoyo y yo yo yo y" | |
"yoyoyo yo yo y") | |
[27 :best nil :candidate =+++----- :todo 37] | |
[29 :best =+++----- :candidate =++=---- :todo 37] | |
[51 :best =++=---- :candidate ++++------ :todo 73] | |
[61 :best =++=---- :candidate +-+++----- :todo 88] | |
[63 :best =++=---- :candidate +-++=---- :todo 88] | |
[73 :best =++=---- :candidate +++-+----- :todo 101] |
(worddiff | |
"yoyoyo y yo yo yo y" | |
"yoyoyo yo yo y") | |
[:best nil :candidate ++++------] | |
[:best ++++------ :candidate +++-+-----] | |
[:best ++++------ :candidate +++--+----] | |
[:best ++++------ :candidate +++---+---] | |
[:best ++++------ :candidate +++----+--] | |
[:best ++++------ :candidate +++-----+-] |
(defn distinct-by | |
([f] | |
(fn [rf] | |
(let [seen (volatile! #{})] | |
(fn | |
([] (rf)) | |
([result] (rf result)) | |
([result x] | |
(let [v (f x)] | |
(if (contains? @seen v) |
(52 49 48 47 46 45 42 39 38 35 34 33 32 31 28 25 24 23 20 19 18 17 14 11 10 9 8 7 4 3 2 1 0) | |
((52 49 48) (49 48 47) (48 47 46) (47 46 45) (46 45 42) (45 42 39) (42 39 38) (39 38 35) (38 35 34) (35 34 33) (34 33 32) (33 32 31) (32 31 28) (31 28 25) (28 25 24) (25 24 23) (24 23 20) (23 20 19) (20 19 18) (19 18 17) (18 17 14) (17 14 11) (14 11 10) (11 10 9) (10 9 8) (9 8 7) (8 7 4) (7 4 3) (4 3 2) (3 2 1) (2 1 0) (1 0) (0)) | |
(((52 49 48) (49 48 47) (48 47 46) (47 46 45) (46 45 42)) ((45 42 39)) ((42 39 38) (39 38 35) (38 35 34) (35 34 33) (34 33 32) (33 32 31) (32 31 28)) ((31 28 25)) ((28 25 24) (25 24 23) (24 23 20) (23 20 19) (20 19 18) (19 18 17) (18 17 14)) ((17 14 11)) ((14 11 10) (11 10 9) (10 9 8) (9 8 7) (8 7 4) (7 4 3) (4 3 2) (3 2 1) (2 1 0) (1 0) (0))) | |
((52 49 48 47 46) (45) (42 39 38 35 34 33 32) (31) (28 25 24 23 20 19 18) (17) (14 11 10 9 8 7 4 3 2 1 0)) | |
((52 49 48 47 46 45) (42 39 38 35 34 33 32 31) (28 25 24 23 20 19 18 17) (14 11 10 9 8 7 4 3 2 1 0)) |
<body> | |
<style type="text/css"> | |
body { | |
width: 600px; | |
margin-left: auto; | |
margin-right: auto; | |
} | |
pre { | |
white-space: pre-line; | |
} |
(defmacro locals-map [& [env]] | |
;; https://gist.github.com/noisesmith/3490f2d3ed98e294e033b002bc2de178 | |
(let [ks (->> (or env &env) | |
keys | |
(remove #{'_}) | |
(remove #(-> % name (str/includes? "__"))))] | |
(zipmap (map name ks) ks))) | |
(defmacro pp-locals [] | |
`(clojure.pprint/pprint |