Skip to content

Instantly share code, notes, and snippets.

(ns user.demo-4-webview
"Photon fullstack query/view composition with client/server transfer"
(:require [datascript.core :as d]
[hyperfiddle.photon :as p]
[hyperfiddle.photon-dom :as dom]
[hyperfiddle.photon-ui :as ui]
user.util)
#?(:cljs (:require-macros user.demo-4-webview)))
(defonce conn #?(:cljs nil ; state survives reload
@dustingetz
dustingetz / photon todo demo .cljc
Last active August 15, 2022 21:47
Full stack, multiplayer todo list app in one file
(ns app
"Full stack, multiplayer todo list app in one file"
(:require [datascript.core :as d]
[hyperfiddle.photon :as p]
[hyperfiddle.photon-dom :as dom]
[hyperfiddle.photon-ui :as ui])
#?(:cljs (:require-macros app)))
(defonce !conn #?(:clj (d/create-conn {}) :cljs nil))
(require '[hyperfiddle.photon :as p]
'[hyperfiddle.api :as hf])
(hfql [{(submissions "")
[{(:dustingetz/shirt-size . {::hf/options (shirt-sizes gender)})
[:db/id :db/ident]}
{(:dustingetz/gender . {::hf/options (genders)})
[:db/id (:db/ident . {::hf/as gender})]}]}
{(genders)
[:db/ident]}])
@dustingetz
dustingetz / crud.cljc
Last active February 20, 2022 02:06
100 LOC crud app
(ns user.blog-100-loc-crud-app
"Concrete minimum viable crud app that demonstrates strong composition and real world edge cases"
(:require
[clojure.spec.alpha :as s]
#?(:clj [datomic.api :as d])
[hyperfiddle.api :as hf]
[hyperfiddle.photon :as p]
[hyperfiddle.photon-dom :as dom]
[hyperfiddle.html5 :as-alias html]))
(ns dustin.y2021.missionary_promise
(:require [hyperfiddle.rcf :as rcf :refer [tests % !]]
[missionary.core :as m]))
; We want to turn a promise-thing into a Task
; Leo: The problem with Promise and CompletableFuture is no cancellation
; What task do we want? Is the task listening to the promise? Or is the task the process backing the promise?
; Background: when you get a promise, there is a process in the background which eventually completes the promise.
; Do you want to await the result of an already running promise
; or do you want to run the process of the promise when the task is run?
(ns leo.file-watcher
(:require
[clojure.edn :as edn]
[clojure.java.io :as io]
[missionary.core :as m])
(:import
(java.nio.file Path FileSystems Paths WatchEvent$Modifier StandardWatchEventKinds
StandardWatchEventKinds$StdWatchEventKind WatchEvent)
(com.sun.nio.file SensitivityWatchEventModifier)
(java.io File PushbackReader)))
(ns hyperfiddle.via
(:require
[meander.epsilon :as m :refer [match]]
[meander.strategy.epsilon :as r]
[minitest :refer [tests]]))
(comment
; Goal here is to implement async/await sugar like this:
(via* (->Maybe)
(ns user.dustin.bind10
(:require
[contrib.do :refer [Do-via via* !]]
[meander.epsilon :as m :refer [rewrite]]
[meander.strategy.epsilon :as r]))
(declare do> mlet pure fmap fapply bind)
(comment
(ns user.dustin.minitest2
(:refer-clojure :exclude [test])
(:require
[meander.epsilon :as m]
[taoensso.timbre :refer [error]]))
(declare tests test!)
(def ^:dynamic *tests* (atom {}))
@dustingetz
dustingetz / install-Python-AmazonLinux-20171023.log
Created August 10, 2020 01:59 — forked from mrthomaskim/install-Python-AmazonLinux-20171023.log
Amazon Linux AMI, pyenv, virtualenv, Python, ... Hello, World!
### prerequisites
sudo yum groupinstall "Development Tools"
git --version
gcc --version
bash --version
python --version # (system)
sudo yum install -y openssl-devel readline-devel zlib-devel
sudo yum update
### install `pyenv`