Skip to content

Instantly share code, notes, and snippets.

@phronmophobic
Created October 30, 2025 18:24
Show Gist options
  • Select an option

  • Save phronmophobic/8fff02625e1dcf18fbe722180a3f7efb to your computer and use it in GitHub Desktop.

Select an option

Save phronmophobic/8fff02625e1dcf18fbe722180a3f7efb to your computer and use it in GitHub Desktop.
;; {:deps {org.clojure/clojure {:mvn/version "1.12.1"}
;; com.github.seancorfield/next.jdbc {:mvn/version "1.3.1070"}
;; org.xerial/sqlite-jdbc {:mvn/version "3.47.1.0"}
;; com.github.seancorfield/honeysql {:mvn/version "2.7.1350"}}}
(ns com.phronemophobic.reagentdewey)
(require '[clojure.java.io :as io]
'[honey.sql :as sql]
'[next.jdbc :as jdbc])
;; next.jdbc db spec
(def db {:dbtype "sqlite"
:dbname "dewey.sqlite"})
;; helper functions
(defn q
"Takes a honey sql query and runs it on db, returning the results."
[m]
(jdbc/execute! db (sql/format m
{:quoted true})))
;; require reagent.core 7656
;; atom 6269
;; render 3581
;; require reagent.dom 1664
;; with-let 1114
;; :dangerouslySetInnerHTML 1036
;; cursor 670
;; track 170
;; wrap 94
;; track! 65
;; reaction 60
;; unsafe-html 16
;; requires
(q {:select [:to [[:count :*] :c]]
:from :namespace-usages
:where [:and
[:in :to ["reagent.core" "reagent.dom"]]]
:group-by [:to]})
[{:namespace-usages/to "reagent.core", :c 4677}
{:namespace-usages/to "reagent.dom", :c 384}]
(q {:select [:name [[:count :*] :c]]
:from :var-usages
:where [:and
[:in :name ["atom" "with-let" "cursor" "track" "wrap" "track!" "reaction" "unsafe-html"]]
[:= "reagent.core" :to]]
:group-by [:name]})
[{:var-usages/name "atom", :c 7212}
{:var-usages/name "cursor", :c 2442}
{:var-usages/name "reaction", :c 31}
{:var-usages/name "track", :c 128}
{:var-usages/name "track!", :c 38}
{:var-usages/name "unsafe-html", :c 8}
{:var-usages/name "with-let", :c 672}
{:var-usages/name "wrap", :c 158}]
(q {:select [:name [[:count :*] :c]]
:from :var-usages
:where [:and
[:in :name ["render"]]
[:in :to ["reagent.dom" "reagent.core"]]]
:group-by [:name]})
[{:var-usages/name "render", :c 681}]
(q {:select [:name [[:count :*] :c]]
:from :keywords
:where [:and
[:= :ns nil]
[:= :name "dangerouslySetInnerHTML"]]
:group-by [:name]})
[{:keywords/name "dangerouslySetInnerHTML", :c 446}]
;; ;; requires
;; "reagent.core" 4,677
;; "reagent.dom" 384
;; ;; var usages
;; "atom" 7,212
;; "cursor" 2,442
;; "reaction" 31
;; "track" 128
;; "track!" 38
;; "unsafe-html" 8
;; "with-let" 672
;; "wrap" 158
;; "render" 681
;; "dangerouslySetInnerHTML" 446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment