Skip to content

Instantly share code, notes, and snippets.

Avatar

Dustin Getz dustingetz

View GitHub Profile
View minitest-example.clj
(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)
View rewrite-await.cljc
(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
View hyperfiddle-metamodel.md

This is probably going to be the next iteration of the declarative CRUD metamodel that powers Hyperfiddle. It's just a design sketch, the current metamodel in prod is different. Hyperfiddle is an easy way to make a CRUD app. Hyperfiddle is based on Datomic, a simple graph database with the goal of "enabling declarative data programming in applications."

CRUD UI definition

This extends Datomic pull syntax into something that composes in richer ways. The key idea is that Pull notation expresses implicit joins and thus can be used to declare data dependencies implicitly, without needing to name them. We also handle tempids, named transactions, and hyperlinks to other pages. We satisfy the hypermedia constraint, like HTML and the web.

{identity                                                   ; Pass through URL params to query
 [{:dustingetz/event-registration                           ; virtual attribute identif
View minitest.clj
(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 Aug 10, 2020 — forked from mrthomaskim/install-Python-AmazonLinux-20171023.log
Amazon Linux AMI, pyenv, virtualenv, Python, ... Hello, World!
View install-Python-AmazonLinux-20171023.log
### 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`
View microtest.clj
(ns user.test
(:refer-clojure :exclude [test])
(:require
[meander.epsilon :as m]
[taoensso.timbre :refer [error]]))
(def tests-enabled true)
(defmacro test [& body]
View match.clj
[:db/add [:idos.cpc/email "asdf@qwer"] :idos.cpc/email "asdf@qwer"]
(def invalid?
(matches?
#{nil
^:& [map? #(<= (count %) 1)]
#{[_ [a v] a v]
[_ _ :db/id _]}}))
View do-via.cljc
(ns contrib.do
#?(:cljs (:require-macros [contrib.do])))
(defn tag-type [tag]
(some->> (re-matches #"^([A-Z][-a-z]*)(.*)$" (name tag)) second keyword))
(defn typed-tag? [tag]
(not (nil? (tag-type tag))))
(defn typed-action? [val]
View datomic stage .clj
(ns user.stage
(:require
[datomic.api :as d]))
(defn with [$ tx]
(:db-after (d/with $ tx)))
(comment
(datomic.api/create-database "datomic:mem://app-db")
You can’t perform that action at this time.