I’ve been working my way up the Kubernetes learning curve.
These notes are about yaml
.
- Using Kubernetes (K8s) involves many
yaml
"manifests" yaml
is a thoughly modern way to do "infrastructure as code" (IaC)
You create a fsm via an effect:
(reg-event-fx
:id
(fn [_ _])
{:fsm {:create {:id 123
:initial-state {}
:log-fn (fn [fsm-db db trigger new-state] ...)
Recently Rich Hickey's communicated to the Clojure community via a Gist. When reading it, I was struck by how similar it was to his previous communication via Reddit.
And that lead me to wonder: if that previous communication didn't do the job, why would this latest one work when it is so similar? Will his new communication cause some useful structural change or will we just see an action replay of this same community processes in another 6 months?
Unfortunately, I think we are stuck in a cycle and we'll soon see a repeat of this angst. Do the same thing, you get the same result. Fine, but what is it that might cause Rich Hickey's interventions to be ineffective? What could be done differently?
Before going on, we should acknowledge that there is a cost to these interventions. Rich Hickey appears angry when he writes them and he is striking out and down, and this
;; What you are looking at: I just picked up this code from one of our apps, and dumped it here unedited. | |
;; It shows how to do DnD with reagent/re-com, using the terrible HTML5 API. | |
;; I haven't done anything to shrink this code down. It is a straight cut and paste from live code | |
;; so it is complicated by many real world, application issues, sorry. It is also very early | |
;; code for us, on coming to cljs, so it probably contains all sorts of ugly and embarasing attrocities. | |
;; But it does work. | |
;; So, as background, when trying to understand what the code is doing, imagine a panel containing | |
;; a "table" of rows. Each row displays "a single daypart" item (it doesn't matter what a daypart is) |
View functions with a subscription are not pure. They are obtaining an "input" from a non argument source. | |
From a practical point view, I haven't been motivated to solve this problem - non-local reasoning is not a problem, and neither is testing because subscribe is easy to stub out, so it feels like you are dealing with a pure function - HOWEVER from a theoretical point of view, this is certainly a "pebble in the shoe". In due course, I'd like it fixed. | |
Here's a quick sketch of approximated how (not all issues resolved): | |
1. create a new `reg-view` function thru which all views are associated with an `id`. Make this registration much like `reg-sub` in the way that you can nominate N signal inputs via a signals function. | |
2. change Reagent so that the first element of vector can be an `id` previously registered by `reg-view`. So, instead of `:div`, you could use `:something/panelX` | |
Would be used like this (notice how similar this is to reg-sub): |
In re-com v0.10.0
, we made changes to the way popover-anchor-wrapper
interacts with its :popover
child.
These changes are backwards imcompatable and, as a result, you'll probably have to made some light modifications to the components given as the :popover
.
Typically, popover-context-wrapper
is used to create the :popover
child of popover-anchor-wrapper
, like this:
[popover-anchor-wrapper
...
I've only written this from a cljs point of view.
code is untested
Callback version:
(defn wait-for-event
"Waits for an event to occur and then calls 'callback-fn'.
'ids' can be a single event id, or a collection of ids.
'callback-fn' is called when any one of the nominated event ids occurs.
This Gist is out of date. It has been superseded by a real repo:
https://github.com/Day8/re-frame-async-flow-fx
When an App boots, it performs a set of tasks to initialise itself.
;; Version 3 | |
;; What follows is indicative of how re-frame's new `regsub` might work/look. | |
;; | |
;; I've taken the todomvc subscriptions and rewritten them using a new, mythical | |
;; macro `regsub`, just to see if I like the result. | |
;; Original: https://github.com/Day8/re-frame/blob/4b931fe67208c10ae960c683fd837b03c38f88b0/examples/todomvc/src/todomvc/subs.cljs | |
(ns todomvc.subs | |
(:require [re-frame.core :refer [regsub]])) |
> This Gist is out of date. It has been superseded by | |
> https://gist.github.com/mike-thompson-day8/d61692451166e206a9c43771c8b389fc | |
;; Version 2 | |
;; WARNING: this code is untested. It probably doesn't even compile. | |
;; It is meant to be indicative of how `regsub` might work/look. | |
;; I've taken the todomvc subscriptions and I've rewritten them using a new mythical | |
;; macro `regsub`. | |
;; Existing: https://github.com/Day8/re-frame/blob/4b931fe67208c10ae960c683fd837b03c38f88b0/examples/todomvc/src/todomvc/subs.cljs |