Skip to content

Instantly share code, notes, and snippets.

(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))
(defn distinct-by
([f]
(fn [rf]
(let [seen (volatile! #{})]
(fn
([] (rf))
([result] (rf result))
([result x]
(let [v (f x)]
(if (contains? @seen v)
(worddiff
"yoyoyo y yo yo yo y"
"yoyoyo yo yo y")
[:best nil :candidate ++++------]
[:best ++++------ :candidate +++-+-----]
[:best ++++------ :candidate +++--+----]
[:best ++++------ :candidate +++---+---]
[:best ++++------ :candidate +++----+--]
[:best ++++------ :candidate +++-----+-]
(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]
@akovantsev
akovantsev / gol.html
Created April 3, 2022 11:31
game of life
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
row {
display: block;
height: 5px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<canvas id="field" width="800" height="600"></canvas>
<script type="application/javascript">
@akovantsev
akovantsev / str-to-plantuml-url.clj
Created April 11, 2023 15:57
string to plantuml url
(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
@akovantsev
akovantsev / stupid-shit.txt
Created June 28, 2025 09:32
stupid shit i do because my ide/language/vcs/tools suck
use .txt instead of .md to avoid adding <br> manually where i want linebreak.
use spaces to align columns because ide can't align across several expressions
(defn foo [x])
(defn quux [x])
use commas to align columns because ide's autoformatter removes spaces manually added to funky locations.
(defn foo, [x])
(defn quux [x])