(defn debug-cljs-devtools
"This is a drop-in alternative for the offical re-frame `debug` middleware
It is better because:
- it writes data, rather than strings, to js/console. This better leverages
the power of cljs-devtols.
- it exploits js/console's ability to colorize text, hopefully making the
output easier to grok."
[handler]
(fn debug-handler
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
> This Gist is out of date. It has been superseded by | |
> https://gist.github.com/mike-thompson-day8/d61692451166e206a9c43771c8b389fc | |
;; WARNING: this code is untested. In fact not even compiled. | |
;; It is just meant to be indicative of how `regsub` might work/look. | |
(ns todomvc.subs | |
(:require-macros [reagent.ratom :refer [reaction]]) | |
(:require [re-frame.core :refer [register-sub]])) |
Persistent Data Strctures use structural sharing to create an efficient in-memory representation, but these same structures can be a problem to serialize/deserialize.
First, the shared parts are duplicated in the serialised output which can lead to a large and inefficient representation.
Second, when the process is reversed, deserialization doesn't recreate the original, shared, effcient in-memory representation because sharing information was lost in the original serialisation.
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 on-changes | |
"Middleware factory which acts a bit like \"reaction\" (but it flows into db , rather than out) | |
It observes N inputs (paths into db) and if any of them change (as a result of the | |
handler being run) then it runs 'f' to compute a new value, which is | |
then assoced into the given out=path within app-db. | |
Usage: | |
(defn my-f | |
[a-val b-val] |
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
<html lang="en"> | |
<head> | |
<title>Unit Tests</title> | |
<!-- Use a monspace font and a dark theme --> | |
<!-- Colour Palet from http://clrs.cc/ --> | |
<style> | |
body { | |
font-family: Courier, "Courier New", monospace; | |
font-size: 11; |
NewerOlder