Skip to content

Instantly share code, notes, and snippets.

View otfrom's full-sized avatar
I may be slow to respond.

Bruce Durling otfrom

I may be slow to respond.
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@otfrom
otfrom / dataset_sankey.clj
Created November 22, 2022 11:23
Converting some datasets (badly) into a sankey chart using plotly and clerk
(let [links (tc/dataset
[{:source 0 :target 2 :value 8}
{:source 1 :target 3 :value 4}
{:source 0 :target 4 :value 2}
{:source 2 :target 5 :value 8}
{:source 3 :target 5 :value 4}
{:source 3 :target 5 :value 2}])
nodes (tc/dataset {:label ["red" "orange" "yellow" "green" "blue" "violet"]
:color ["red" "orange" "yellow" "green" "blue" "violet"]})]
(clerk/plotly
^{:nextjournal.clerk/visibility {:result :hide}}
(defn md-row [v]
(str "| " (apply str (interpose " | " v)) " |\n"))
^{:nextjournal.clerk/visibility {:result :hide}}
(defn md-table [{:keys [columns alignment-spec data]}]
(clerk/md
(apply
str
(into [(md-row columns)
@otfrom
otfrom / spec.json
Created December 21, 2023 13:49
Vega-Lite spec from Thu Dec 21 2023
{
"height": 800,
"width": 1360,
"title": {"text": "Number of Children in Care", "fontSize": 24},
"config": {
"legend": {"titleFontSize": 20, "labelFontSize": 14},
"axisX": {"titleFontSize": 16, "labelFontSize": 12},
"axisY": {"titleFontSize": 16, "labelFontSize": 12}
},
"data": {
(defun refile-by-created ()
(interactive)
(let* ((capture-header "* From Orgzly")
(created-ts (org-entry-get nil "created"))
(timestamp (cadr (org-timestamp-from-string created-ts)))
(file-date (format "%04d-%02d-%02d"
(plist-get timestamp :year-start)
(plist-get timestamp :month-start)
(plist-get timestamp :day-start))))
(org-cut-subtree)