This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns datascript-diff | |
(:require [datascript.core :as d] | |
[datascript.btset :as btset])) | |
(defn- keys-eq? [a b] | |
(or (identical? (.-keys a) (.-keys b)) | |
(let [achunk (btset/iter-chunk a) | |
bchunk (btset/iter-chunk b)] | |
(and (== (count achunk) (count bchunk)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cljs-react-navigation.reagent | |
(:require [cljs-react-navigation.base :as base] | |
[reagent.core :as r] | |
[reagent.impl.component :as ric] | |
[cljs.spec :as s :include-macros true] | |
[cljs.spec.test :as stest :include-macros true] | |
[cljs.spec.impl.gen :as gen] | |
[oops.core :refer [oget oget+ oset! ocall oapply ocall! oapply!]] | |
[taoensso.timbre :refer-macros [log trace debug info warn error]])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cljs-react-navigation.base | |
(:require [reagent.core :as r] | |
[reagent.impl.component :as ric] | |
[cljs.spec :as s :include-macros true] | |
[cljs.spec.test :as stest :include-macros true] | |
[cljs.spec.impl.gen :as gen] | |
[taoensso.timbre :refer-macros [log trace debug info warn error]] | |
[oops.core :refer [oget oset! ocall oapply ocall! oapply!]])) | |
(defonce React (js/require "react")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn virtualized-list | |
"Reagent version of VirtualizedList | |
https://facebook.github.io/react-native/releases/0.43/docs/virtualizedlist.html | |
props = Map with at least :data and :renderItem specified | |
:data = A vector (or list I suppose) with whatever you want passed to each row | |
:renderItem = A fn that accepts a map with two keys {:item row-data, :index row-number} and returns a reagent vector. | |
Ex. [virtualized-list {:data [{:a 1} {:a 2}] | |
:renderItem (fn [{:keys [item index]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn user-info | |
"Updates a user entity with form-data supplied by the user. | |
Steps: | |
1. Validate the data. | |
2. Ensure that I'm only updating certain keys. (since spec allows extra keys) | |
3. Create a merged map to update the entity. (this feels hacky!) | |
4. Create an audit map. | |
5. Transact and return success." | |
[conn form-data user] | |
(if (s/valid? :user/info form-data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def sample-data '(#datascript/Datom [1 :attendance/checkInTime "2016-07-08T08:27:50.778Z" "536870913" true] #datascript/Datom [1 :attendance/group 16 "536870913" true] #datascript/Datom [1 :attendance/participant 17 "536870913" true] #datascript/Datom [2 :group/absentAfterMinutes 15 "536870913" true] #datascript/Datom [2 :group/endTimeHour 2 "536870913" true] #datascript/Datom [2 :group/endTimeMinute 51 "536870913" true] #datascript/Datom [2 :group/latePickupAfterMinutes 15 "536870913" true] #datascript/Datom [2 :group/name "Group 1" "536870913" true] #datascript/Datom [2 :group/participants 3 "536870913" true] #datascript/Datom [2 :group/participants 8 "536870913" true] #datascript/Datom [2 :group/participants 38 "536870913" true] #datascript/Datom [2 :group/participants 45 "536870913" true] #datascript/Datom [2 :group/participants 58 "536870913" true] #datascript/Datom [2 :group/startTimeHour 1 "536870913" true] #datascript/Datom [2 :group/startTimeMinute 51 "536870913" true] #datascript/Datom [3 :partici |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defstate ReactNativeRouterFlux :start (js/require "react-native-router-flux")) | |
(defstate TabBar :start (.-TabBar @ReactNativeRouterFlux)) | |
(defstate Actions :start (.-Actions @ReactNativeRouterFlux)) | |
(defstate Modal :start (.-Modal @ReactNativeRouterFlux)) | |
(defstate Reducer :start (.-Reducer @ReactNativeRouterFlux)) | |
(defstate router :start (r/adapt-react-class (.-Router @ReactNativeRouterFlux))) | |
(defstate scene :start (r/adapt-react-class (.-Scene @ReactNativeRouterFlux))) | |
(defn reducerCreate [params] | |
(let [defaultReducer (@Reducer params)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns mattsum.simple-example.core | |
(:require-macros [natal-shell.core :refer [with-error-view]] | |
[natal-shell.components :refer [view text image touchable-highlight]] | |
[natal-shell.alert :refer [alert]]) | |
(:require [om.next :as om :refer-macros [defui]])) | |
(set! js/React (js/require "react-native/Libraries/react-native/react-native.js")) | |
(def app-registry | |
(.-AppRegistry js/React)) |