Skip to content

Instantly share code, notes, and snippets.

@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 / electric-presence.md
Last active November 12, 2023 15:46
Multiplayer chat with presence – Electric Clojure

TodoMVC Composed (it's just a for loop!!!) — Electric Clojure

  • An early demonstration "Compiler Managed Network" and the extreme dynamic composition it makes possible
  • TodoMVC Composed merely calls the previous TodoMVC function inside a for loop.
20220822.Todomvc.Composed.mp4
@dustingetz
dustingetz / electric-todomvc.md
Last active August 6, 2023 03:30
Photon TodoMVC, with a twist!

TodoMVC, with a twist! — Electric Clojure

  1. it's multiplayer! 0 LOC cost
  2. state is durable! (server side database) 0 LOC cost
  3. See those pending spinners? We've added a server delay to demonstrate managed load states.
20220817.todomvc.mp4

Electric is a "multi tier" 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. Electric is designed for rich dynamic applications with reactive user interfaces and complex frontend/backend data sync requirements.

@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 / 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

React.js interop POC — Electric Clojure

20220729.photon.reagent.react.interop.mp4

Direct recursion over file system from the frontend — Electric Clojure (2022 June)

This video demonstrates traversing a filesystem tree from the frontend. The filesystem tree exists only on the server, and the HTML view exists only on the client. Nonetheless, we are able to unify the query/view logic into a single recursion in the simple, direct style of PHP, despite network. The Electric compiler automatically coordinates fine-grained reactive network sync.

Code note: in this video from last year, ~@ is the legacy syntax for client/server transfer, it has since been superseded by e/client and e/server markers.

20220621.photon.treeview.with.managed.nework.mp4
  • No API, no client side database, no frontend state at all (except DOM)
  • Literally all accidental complexity GONE
@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.