Skip to content

Instantly share code, notes, and snippets.

realgenekim / compact-report-control.cljc
Last active January 14, 2023 20:43
Custom compact report layout that puts pagination control into the first row, between the report title and control buttons
View compact-report-control.cljc
(ns com.example.ui.custom-report-control
[[com.fulcrologic.fulcro.dom :as dom :refer [div]]
[com.fulcrologic.semantic-ui.addons.pagination.ui-pagination :as sui-pagination]]
[[com.fulcrologic.fulcro.dom-server :as dom :refer [div]]])
[clojure.string :as str]
[com.fulcrologic.fulcro.components :as comp]
[com.fulcrologic.fulcro-i18n.i18n :refer [tr trc]]
realgenekim / does-titles.titles.clj
Last active October 6, 2022 03:09
These are selected portions of the code to do the analysis presented here: Analysis Of DevOps Enterprise Summit Speaker Titles (2014-2022):
View does-titles.titles.clj
; I'll post entire repo of how to use this analysis code, but I wanted to get something
; up right away
(ns does-titles.titles
[better-cond.core :as b]
[clojure.string :as str]
[clojure.test :refer :all]
[com.fulcrologic.guardrails.core :refer [>defn >defn- >def | ? =>]]))
View incrementally-loaded-report-gk.cljc
(ns com.example.state-machines.incrementally-loaded-report-gk
;(ns com.fulcrologic.rad.state-machines.incrementally-loaded-report
"Gene modifications to incrementally-loaded-report --
This has the same interface as the 'incrementally-loaded-report' UISM included in RAD.
However, instead of rendering only after the resolver resturns the entire data set,
it renders immediately after the first load completes, and use df/load! to asynchronously load
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 July 21, 2023 14:29
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 February 16, 2021 17:58
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 December 30, 2022 12:13
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 August 28, 2020 16:43
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))