Skip to content

Instantly share code, notes, and snippets.

View fulcro-rad-custom-state-machine.cljc
; @tony.kay Good talking yesterday — and you’ve turned me into a believer on UI State Machines.
; You had suggested that instead of replacing each state, one by one, to just copy the entirety into my
; namespace, to make it easier.
; Got all the needed changes to lazily load all the Trello card comments very quickly. Eventually, I’ll post the diffs vs. the default RAD report state machine, which will make it more obvious what my changes were. But, just in case, to anyone who might find it helpful, here’s what I did.
; change any :: to ::report
; wrote a my-load-report! my-goto-page* and a load-comments-for-page
; Surprisingly straightforward to do, as @holyjak and @tony.kay predicted!
realgenekim /
Last active Mar 18, 2022
How to download all Clojure dependencies using clj (equivalent to "lein deps")

I recently had to figure out for a Clojure application how to download all dependency JAR files, for use in a Docker container.

When creating an uberjar, depstar re-downloaded all the external dependencies from Maven central, even though in an earlier Docker build step, I ran clj -Spath to pre-download them (presumably cached into the .m2 directory). In the past, I've used lein deps to do something similiar.

I'm grateful for Sean Corfield helping out (again!!): In short, use clj -P (short for "prepare") to download dependencies. Note the "A:depstar" option, which ensures that the depstar dependencies are downloaded, too.

Here's what it looks like in a Dockerfile:

# to pre-download dependencies, only done if deps.edn changes
realgenekim / db.clj
Last active Feb 16, 2021
Example of getting UTF-8 working with next.jdbc with MySQL, to enable Unicode and emojis, along with using using "REPLACE" instead of "INSERT" to enable upserts.
View db.clj
(ns db.db2
[next.jdbc :as j]
[next.jdbc.sql :as jsql]
[next.jdbc.sql.builder :as jb]
[clojure.spec.alpha :as s]))
(def mysql-db {:dbtype "mysql"
:dbname "twitter"
:host ""
realgenekim /
Last active Oct 13, 2020
Here's a basic skeleton of how to create a Vega arc diagram

Vega-lite is awesome and graphs are easy to create.

Vega is... wow... you've got to write a lot more JSON to generate a graph.

Here is a skeleton Vega Arc diagram that you can use to create your own -- I couldn't find one on the internet, and it took me nearly six hours to figure out how to create one.

Enjoy! Gene

View trello_interfaces.cljs
(ns trello-workflow.trello-interfaces
(:require [re-frame.core :as re-frame]
[ajax.core :as ajax]
[ :as io]
[goog.string :as gstring]
(defprotocol TrelloInterface
" interface to loading boards, lists, cards
{:command :load-board
View oz-demos.clj
(ns analyze.oz
(:require [oz.core :as oz]
[ :as json]))
#_ (oz/start-plot-server!)
(defn group-data [& names]
(apply concat (for [n names]
(map-indexed (fn [i x]
realgenekim / firebase.clj
Last active Aug 28, 2020
attempt to get Google Cloud Firestore working in Clojure
View firebase.clj
(ns firebase1.core
(:require [ :as io]
[clojure.core.async :as async]
[clojure.reflect :as r])
(:import ( GoogleCredentials)
( FirebaseOptions$Builder)
( FirebaseApp)
( FirestoreClient))
realgenekim / project.clj
Created Sep 5, 2018
attempt to get multiple entry points running using figwheel.main
View project.clj
(defproject trello-workflow "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/clojurescript "1.10.339"]
;[org.clojure/clojurescript "1.9.946"]
[org.clojure/core.async "LATEST"]
[org.clojure/test.check "0.10.0-alpha2"]
[reagent "0.7.0"]
[re-frame "0.10.5"]
[ "0.1.6"]
[secretary "1.2.3"]
View Ibid.hs
-- Build this with "ghc ibid.hs"
-- Test it with "./ibid"
-- Import some list functions
import Data.List
-- Some refs to test on
refs = ["book1","book2","ibid","ibid","paper1","ibid","paper2","book3"]
-- Code close to what John wrote that will work in ghci
View Ibid.cljs
(def in ["a" "ibid" "ibid" "b"])
(defn ibid
(ibid (vec (first in)) (rest in))
([left right]
(println left right)
(if (empty? right)
; done