Skip to content

Instantly share code, notes, and snippets.

Matthew Chadwick Hendekagon

Block or report user

Report or block Hendekagon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Hendekagon / programmer_jargon
Created Jun 9, 2017
A list of programmer jargon
View programmer_jargon
modulo - 'except' as in "modulo means an equivalence relation modulo its use by programmers"
orthogonal - 'unrelated' as in "the use of 'orthogonal' by programmers is orthogonal to its use by mathematicians"
land, landed - when a new feature is added to a library, it isn't mearly 'added', it 'lands' -- as if from the heavens, like a magical bird or an expensive jet
cut - when a new version of library is released it isn't mearly 'released' it is 'cut' -- like a sparkling diamond
curated - if you release a list that wasn't created by an algorithm, then say it's 'curated' as in "A curated list of programmer jargon"
Hendekagon / 206
Created Sep 28, 2017
add 206 partial content in Aleph
View 206
; ---- the following fns copied from ring.util.response because they were
; useful but private ----
(defn canonical-path [^File file]
(str (.getCanonicalPath file)
(if (.isDirectory file) File/separatorChar)))
(defn safe-path? [^String root ^String path]
(.startsWith (canonical-path (File. root path))
(canonical-path (File. root))))
View gist:d3877ae82f9418d687c7ecfec09fe881
(use 'criterium.core)
=> nil
(defprotocol p1 (pt [this]))
=> p1
(extend-type Number p1 (pt [this] (list this)))
=> nil
(extend-type clojure.lang.PersistentList p1 (pt [this] this))
=> nil
(defn pf [x] (if (list? x) x (list x)))
=> #'user/pf
View gist:ce7b654a92485847cbcce5884cf55b28
dev:cljs.user=> (-> (a/coll-zip [3 {:x 5} 7 [4 {:y 17}] 9]) z/down z/right z/down z/down z/right (z/edit inc) z/next z/prev (z/edit inc) a/fip)
[3 ([:x 7]) 7 [4 {:y 17}] 9]
dev:cljs.user=> (-> (a/coll-zip [3 {:x 5} 7 [4 {:y 17}] 9]) z/down z/right z/down z/down z/right (z/edit inc) (z/edit inc) a/fip)
[3 {:x 7} 7 [4 {:y 17}] 9]
Hendekagon / gist:833c6d5605c8ccca50dd15cee996a370
Created May 24, 2017
Comparing performance of Clojure's protocols, records and maps for fn dispatch
View gist:833c6d5605c8ccca50dd15cee996a370
(deftype Qp [] Q (q [this x] x))
=> user.Qp
(def Qm {:q (fn [x] x)})
=> #'user/Qm
(def Qp1 (Qp.))
=> #'user/Qp1
(c/quick-bench (q Qp1 7))
Evaluation count : 150426264 in 6 samples of 25071044 calls.
Execution time mean : 2.073561 ns
Execution time std-deviation : 0.274594 ns
View copy2clip
(defn copy2clip [x]
(let [w (StringWriter.)]
(pprint x w)
(.. Toolkit getDefaultToolkit getSystemClipboard
(setContents (StringSelection. (.toString w)) nil))))
Hendekagon /
Last active May 1, 2017
bit pattern symmetry layout for Roassal
'From Pharo3.0 of 18 March 2013 [Latest update: #30846] on 1 May 2017 at 5:58:40.759228 pm'!
Object subclass: #F
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'fredkin'!
!F commentStamp: 'mjc 3/26/2015 10:19' prior: 0!
Hendekagon / gta
Last active Apr 16, 2017
Cyclic tag system in Clojure
View gta
; t a list of productions, a an initial sequence
; note this halts with a NPE - it should really
; check for (empty? a) and reduced
(defn g [t a]
(fn [[g & t] a]
(if (== 1 g) (concat t a) t))
a (cycle t)))
View gist:b9dfef3253b6e0f50785d705137e9080
PREFIX wd: <>
PREFIX wdt: <>
View gist:7fed4483e90ce398e772bc494b5730e2
(use 'criterium.core)
=> nil
(def v1 (vec (range 1000000)))
=> #'user/v1
(def m1 (into {} (map vector (range 1000000) (range 1000000))))
=> #'user/m1
(quick-bench (get m1 71))
Evaluation count : 9861456 in 6 samples of 1643576 calls.
Execution time mean : 60.482667 ns
Execution time std-deviation : 1.681717 ns
You can’t perform that action at this time.