Skip to content

Instantly share code, notes, and snippets.

@mdhaney
mdhaney / pull-many.clj
Created April 11, 2020 03:52
pull-many implementation for Datomic Cloud
(defn pull-many
"like Datomic pull, but takes a collection of ids and returns
a collection of entity maps"
([db pull-spec ids]
;; IMPLEMENTATION NOTE
;;
;; We use a Datomic query with a collection binding on the input to simulate pull-many.
;; This performs well even in distributed/development mode, as it's only 1 request over
;; the wire. If that was all there was to it, this function would be like 3 lines long,
;; but unfortunately it's a bit more difficult because the collection binding doesn't
@mdhaney
mdhaney / test_data.clj
Created March 18, 2019 20:03
Datomic Cloud testing
(ns ct-server.test-data
(:require [clojure.test :refer :all]))
(def user1 {:user/username "user1"
:user/email "user1@somedomain.com"
:user/public? false})
(def user2 {:user/username "user2"
:user/email "user2@somedomain.com"
:user/public? false})
@mdhaney
mdhaney / core.cljs
Created February 20, 2019 21:09
Fulcro - Expo bootstrapping
(ns core
(:require [fulcro.client.primitives :as prim]
[fulcro.client :as fc]
[fulcro.client.data-fetch :as df]
[fulcro.client.network :as net]
[expo :as expo]
[myapp.root :refer [MyRealFulcroRoot]
[support :as sup]
[oops.core :refer [ocall]]))
@mdhaney
mdhaney / core.cljs
Created October 24, 2014 03:26
Foundation off-canvas nav Reagent
(defn employee-menu [state event]
(let [open? (atom false)]
(subscribe-to event :show-employee-menu [_]
(reset! open? true))
(subscribe-to event :hide-employee-menu [_]
(reset! open? false))
(subscribe-to event :hide-left-menu [_]
(publish event :hide-employee-menu))