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 '[clj-diff.core :as d]) | |
(require '[clojure.set :as set]) | |
(defn mdiff [ma mb base-path] | |
(let [es (reduce | |
(fn [m k] | |
(let [vb (get mb k) | |
kp (conj base-path k)] | |
(if-let [va (get ma k)] | |
(if (not= va vb) |
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 '[clojure.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
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
(ns app | |
(:require [om.core :as om :include-macros true])) | |
(defn log-tx [tx-data root-cursor] | |
(let [{:keys [path old-value new-value]} tx-data | |
c js/console] | |
(doto c (.group (str "TRANSACTION " path)) (.groupCollapsed "OLD")) | |
(prn (pr-str old-value)) | |
(doto c (.groupEnd) (.group "NEW")) | |
(prn (pr-str new-value)) |
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
var Dialog = React.createClass({ | |
render: function() { | |
// 1) render nothing, this way the DOM diff will never try to do | |
// anything to it again, and we get a node to mess with | |
return React.DOM.div(); | |
}, | |
componentDidMount: function() { | |
// 2) do DOM lib stuff | |
this.node = this.getDOMNode(); |
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
;;; To add a tooltip, write (tooltip {:className "foo"}) instead of #js {:className "foo"} | |
;;; You can simplify this and just show what you need: #js {:title (pr-str (om/...))}. | |
;;; testfoo.core (cljs) | |
(ns testfoo.core | |
(:require-macros [testfoo.macros :refer (tooltip)]) | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[cljs.reader :as reader])) |
2015-01-29 Unofficial Relay FAQ
Compilation of questions and answers about Relay from React.js Conf.
Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.
Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).
OlderNewer