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
boot-react-native/example$ boot -v dev | |
registering react-support [:create :modify :delete] | |
registering react-support/cljsjs [:create :modify :delete] | |
registering src [:create :modify :delete] | |
registering src/mattsum [:create :modify :delete] | |
registering src/mattsum/simple_example [:create :modify :delete] | |
sending change event | |
Syncing project dirs to temp dirs... | |
Acquired java.util.concurrent.Semaphore@68567e20[Permits = 0]... |
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
;; React supports "refs" as a way for a component to get a | |
;; handle to its children. Classically, refs were string-based. | |
;; Recent versions of React support callback attributes as a | |
;; more elegant variant of accessing DOM notes or components. | |
;; | |
;; This example uses a Form-3 component as per | |
;; https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components | |
;; | |
;; For callback refs, see React's documentation | |
;; https://facebook.github.io/react/docs/more-about-refs.html |
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
#!/usr/bin/env python | |
# Cleans up the output of "react-native log-ios" by | |
# removing all output not related to your app, similarly | |
# to how it works in the XCode debug window | |
# | |
# Usage: react-native log-ios | ./react-native-only.py "<string>" | |
# | |
# where "<string>" is the name of your app as known | |
# to the iOS logging system. E.g. "SimpleExampleApp" |
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
#!/usr/bin/env python | |
# | |
# boot-react-native-no-dev.py | |
# | |
# Patch jsbundle to set __DEV__ to false | |
# | |
# The React Native packager often cannot handle Google Closure-generated JS files | |
# if `--dev false` is set, eventually running out of memory. As a workaround, | |
# use `--dev true` and patch the __DEV__ setting in the output bundle to | |
# false. |
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
;; This demonstrates the container component pattern | |
;; used with reagent (or re-frame) | |
;; | |
;; - listen for props changes | |
;; - inner component (foo-view) gets data passed as prop | |
;; - outer component (foo) reacts to prop changes by fetching data | |
;; | |
;; see https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0 | |
;; | |
;; For reagent's handling of props, see https://www.martinklepsch.org/posts/props-children-and-component-lifecycle-in-reagent.html |
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
#!/usr/bin/env python | |
# Patch jsbundle to set __DEV__ to false | |
import sys, re | |
print(re.sub(r'__DEV__\s*=\s*true;', "__DEV__=false;", | |
sys.stdin.read())) |
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 error-boundary.error-boundary | |
(:require [reagent.core :as r] | |
[reagent.impl.component :as comp] | |
[reagent.impl.util :as util] | |
[goog.object :as gobj])) | |
;; (c) 2016 Paulus Esterhazy | |
;; | |
;; License: MIT |
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 make-intersection-q | |
"Generate an intersection q for arbitrary sets of features" | |
[n] | |
(assert (pos? n)) | |
{:find '[[?product-slug ...]] | |
:in ['$ (->> (range 1 (inc n)) (mapv #(symbol (str "?v" %))))] | |
:where | |
(into ['[?product :cat.product/slug ?product-slug]] | |
(map (fn [n] | |
['?product :cat.product/features (symbol (str "?v" n))]) |
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
;; Makes it easier to work from the REPL | |
;; | |
;; Don't use these from production functions | |
(defonce !c (atom nil)) | |
(defn rdc [] | |
(let [c @!c] | |
(assert c "Database not connected") | |
c)) |
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
;; Helpers for looking up and updating datomic db entities from the REPL | |
(defn every-eid | |
"Returns set of ids of entites that have a given attribute" | |
[db attr] | |
(into #{} (d/q '[:find [?e ...] | |
:in $ ?attr | |
:where [?e ?attr]] | |
db attr))) |