Skip to content

Instantly share code, notes, and snippets.

@dustingetz
dustingetz / contrib.remark.cljs
Created March 31, 2023 18:27
remark markdown extension (2018)
(ns contrib.ui.remark
(:require
;["@hyperfiddle/remark-generic-extensions/lib/browser.min" :as remark-generic-extensions] ; works in node
[clojure.set]
[clojure.string]
; Refrain from contrib imports so this is more suitable for userland
[goog.object]
[prop-types] ; used as js/propTypes.object
[reagent.core]
;[remark] ; works in node
@dustingetz
dustingetz / electric-references.md
Last active July 27, 2023 13:39
Reference list — Electric Clojure

References — Electric Clojure

Electric Clojure implements a form of arrowized continuous time dataflow programming with extensions for network-transparent function composition.

@dustingetz
dustingetz / electric-presence.md
Last active November 12, 2023 15:46
Multiplayer chat with presence – Electric Clojure
@dustingetz
dustingetz / missionary-concept-map.md
Last active April 10, 2024 10:58
Missionary concept map

Missionary concept map

Missionary primitives fit into three categories:

Effect descriptions = pure functional programming which is about trees not graphs

  • continuous flow, m/?< (switch)
  • m/watch, m/latest, m/cp
  • m/observe
  • m/reductions, m/relieve
@dustingetz
dustingetz / sql_basic_demo_electric.md
Last active January 30, 2024 17:37
SQL basic demo – Electric Clojure

PostgreSQL hello world — Electric Clojure

How do I integrate a SQL database backend?

Easy:

  • make an ordinary Clojure function query-pokemon-list for the query
  • The query is blocking, and Electric Clojure is async, so use e/offload to move it to a thread pool.
    • (Don't block the event loop!)
  • e/offload throws Pending until the query finishes, and then the exception "goes away"
@dustingetz
dustingetz / a.md
Last active February 25, 2023 23:42
Photon demo: Datomic web explorer in one file

Datomic web explorer

  • Client API, tested on Datomic Cloud
  • database entity browser
  • server paginated infinite scroll
  • streaming information model - displays incremental resultsets as they become available (useful for slow queries)
  • automatic backpressure and cancellation of abandoned queries
  • custom web renderers with dynamic queries

Code is not optimized yet – we are still learning the idioms.

@dustingetz
dustingetz / a.md
Last active October 4, 2022 15:47
HOWTO install `#uri` reader extension in Clojure/Script
@dustingetz
dustingetz / user.clj
Last active September 28, 2022 18:05
binding conveyance
(defmacro future
"Takes a body of expressions and yields a future object that will
invoke the body in another thread, and will cache the result and
return it on all subsequent calls to deref/@. If the computation has
not yet finished, calls to deref/@ will block, unless the variant of
deref with timeout is used. See also - realized?."
{:added "1.1"}
[& body] `(future-call (^{:once true} fn* [] ~@body)))
(defn future-call

List of Photon demos and content

Photon is a network-transparent Clojure/Script dialect for full-stack web application development. It uses macros to let you interweave client and server code in a single .CLJC file, so you can define a full-stack frontend/backend webapp all in one place. Photon is designed for stateful full-stack web applications with complex frontend/backend data sync requirements.

Newest demos:

Personal favorites:

Datomic database transaction browser coded in Photon, by nottmey

This fullstack web app is 239 LOC in a single file, coded with just fns in the straightforward/easy style of PHP. All client/server I/O is managed!

It took him 10 hours. Thank you Malte! #Clojure

20220529.Photon.Datomic.Viewer.-.Malte.Nottmeyer.mp4