This file contains hidden or 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
{:paths ["."] | |
:deps {org.clojure/clojure {:mvn/version "1.10.0-alpha4"} | |
org.clojure/clojurescript {:mvn/version "1.10.238"} | |
org.clojure/test.check {:mvn/version "0.10.0-alpha2"}}} |
This file contains hidden or 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
(require '[criterium.core]) | |
(require '[clojure.pprint]) | |
(defn some | |
"Returns the first logical true value of (pred x) for any x in coll, | |
else nil. One common idiom is to use a set as pred, for example | |
this will return :fred if :fred is in the sequence, otherwise nil: | |
(some #{:fred} coll)" | |
{:added "1.0" | |
:static true} |
This file contains hidden or 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 bash -eux | |
# Original by Austin Birch in http://austinbirch.co.uk/clojurescript-react-native-bundling-release.html | |
# updated for metro-bundler 0.9.0 | |
# prevent metro-bundler applying code folding to our cljs output | |
sed -i .bak \ | |
's/(options.minify)/(options.minify \&\& !filename.match(\/release\\.ios\\.js\/))/' \ | |
./node_modules/metro-bundler/src/JSTransformer/worker/index.js |
This file contains hidden or 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
Did: | |
- Built optimizations :advanced, clojurescript 1.9.683 with cljs.loader | |
Happened: | |
- Compilation ran forever. Last output being: | |
`Compiling resources/public/release/js/out/cljs/loader.cljs` | |
Debug: | |
- Ran 5 times: | |
`jstack 54630 >> cljs-loader-compile.stack` |
This file contains hidden or 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
;; Issue with om/transform-reads | |
;; Issue is when having two siblings or cousins with the same read-key | |
;; in nested at level 2 or deeper, transform-reads will two paths | |
;; with the same root. Parsing such query will overwrite the first path | |
;; returning only the second one. | |
;; Example: | |
;; (om/transform-reads r [:foo]) | |
;; returns: [#:join{:parent [#:join{:child1 [:foo]}]} | |
;; #:join{:parent [#:join{:child2 [:foo]}]}] |
This file contains hidden or 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
(defmacro with-defs | |
"Takes a seq of symbols which will be called with def for generated symbols. | |
These symbols will be replaced in the body with the generated symbols | |
Examples: | |
(let [a 1] (macroexpand '(with-defs [a] [a]))) ;; => (do (def a_60267 a) [a_60267]) | |
(let [a 1] (with-defs [a] [a])) ;; => [1]" | |
[vars & body] | |
{:pre [(every? symbol? vars)]} | |
(let [syms (into {} (map (juxt identity #(gensym (str (name %) "_")))) vars) |
This file contains hidden or 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 join [{:keys [parser query target] :as env} k _] | |
(let [ret (parser env query target)] | |
(if target | |
(when (seq ret) | |
{target (assoc ast :query ret)}) | |
{:value ret}))) |
This file contains hidden or 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
(require '[datascript.btset :as btset]) | |
(require '[datascript.arrays :as da]) | |
;; What? | |
;; Fast equality check for btset/Iter | |
;; | |
;; Why? | |
;; There's no history or (d/since ) API and I want to know what's changed between two databases. | |
;; With fast Iter equality checks, I can quickly check if an attribute has changed between | |
;; my two database values like so: |
This file contains hidden or 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
;; Here are 4 different versions of the sieve function with slight changes to test my theories | |
;; around seq, chunked-seq and transducer (reduce) api. | |
;; Try running these yourself with: (run-all) | |
(declare sieves) | |
(defn run-all [] | |
(doseq [[k sieve] sieves] | |
(prn "Running:" k) | |
(dotimes [_ 5] | |
(time (sieve 10000))))) |
This file contains hidden or 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
diff --git a/src/main/om/next.cljc b/src/main/om/next.cljc | |
index ff19d99..3ea9682 100644 | |
--- a/src/main/om/next.cljc | |
+++ b/src/main/om/next.cljc | |
@@ -2517,10 +2517,10 @@ | |
root (:root @state)] | |
#?(:cljs | |
(doseq [c ((:optimize config) cs)] | |
- (let [props-change? (> (p/basis-t this) (t c))] | |
+ (let [props-change? (and (iquery? c) (> (p/basis-t this) (t c)))] |
NewerOlder