Delete .shadow-cljs/build and rebuild to clear caching errors
I fucked up then fixed Jacek’s Cheffy app in four ways: malindented (which causes rewrapping) for the db hashmap (putting key values outside the original map) page-nav (nesting content under it) messages (nesting them within an input container) duplicated a file to model it for another page, but I didn’t update the component name the modal name the file name typed keys instead of key for ^{:key id} malcached it somehow?
Dereference your damn atoms ha
I couldn’t add an image in my app. After many hours, I saw that I passed in an atom to a component without dereferencing it, which caused an image not to load. The values atom had the image. I looked in the from-group, the modal, and the button. I put print statements in the component and the subscription and event it used. The print statement in the subcription showed nil. The print in the :upsert-image event showed an atom with the image.
GitHub couples releases with tags.
I made a GitHub Actions workflow that builds and releases from a repo whenever I push a tag. The on-tag part came from Sean Corfield’s workflow, which I modeled. Patrick’d prefer to avoid thinking of tags (As Elon Musk says, “All input is error”), but GitHub appears to couple releases with tags. The current actions required for a release workflow are git: add [files] commit -S -m "[message]" push tag v[tag number] git push origin tag 3 pushes files, 5 pushes the tag which triggers the workflow.
To fix two shadow-cljs issues, simply restart it and wait :(
I solved five problems from Jacek’s Learn Re-Frame Pro course: Babel transpilation error (solved by restarting shadow-cljs; not understood yet :()) Port already in use despite shutting previous instance down (wait, runs anyway, uses the same nrepl port as others that are running) Things not showing (mis-indent; instead of one fragment containing two elements, one fragrement contained one element, then the other element spilled over–due to ClojureScript returning only the last element, only this spilled element returned; a changed indent pulled it into the fragment due to my paredit extension) Image not showing (I misunderstood the reg-event-fx signature; the second paramater is a vector, [effect …params?
bidi means "bidirectional" (routing)
Dave in Lobster Writer uses bidi to: 1) Decide what should be done for a given uri?, and 2) Given a thing that should be done, what should the uri be? Bidi’s name means “bidi-rectional”, which means the string uri can give a handler, and a handler can give a string. Both cases use the pushy library. When the uri matches a handler in the route, pushy runs a given function that generally loads a matching page.
Use an interceptor to use registered coeffects; use a kv-pair to use registered effects
Re-Frame has two rules for working with registered coffects (world input) and registered effects (output to world): 1) Pull world input with (inject-cofx :coeffect-name) in an interceptor, and 2) Call registered effects by putting a :effect-name :value kv-pair in the returned effect map. To follow these rules, you need to know that effects can pull in a vector of interceptors. These interceptors generally change the hashmap called “coffects” before going to the effect.
Interceptors are hash-map modifiers
Interceptors are hashmaps with an “:id, :before, :after” signature, where the :before and :after keys work with another hashmap of a “:coeffects, :effects, :queue, :stack” signature. Before the event fires, interceptors modify the context (hashmap) with functions mapped to the :before key. The event then fires with the modified context. The context then goes through the :after-bound functions, doing work after the main event has fired. This is useful for dealing with local storage with a Re-Frame db: pull the local storage before firing or push db state to local storage after firing.
Dual mining = less profit?
I think you’re required to mine 30% ETH and 70% another crypto in t-rex with dual-mining. I.e. you can’t flip it for 70% ETH and 30% RVN. The other crypto generally isn’t as valuable, whereas ETH constantly rises, making this less value then a strict 70% ETH operation. Further, dual-mining attempts to trick a smart hash-rate limiting program with variable shutdowns in LHR. Iiuc, solutions to this required underclocking the GPU to avoid hitting LHR limits.
Dave Martin's a Re-Frame master
How did Dave use Re-Frame to make Lobster Writer? He has the classic pages function which takes the subcription to the :active-page key of the db. This gets passed into a case which returns another component function, which gives whatever page. Clicking buttons changes this :active-page key, which updates the subscription, and gives a different page. Wielding reg-event-db, reg-event-fx, reg-fx, reg-cofx, and interceptors; using routing libraries like Bidi and Pushy; and working with misc libraries like React Quill, he makes a fluid and navigable SPA that works locally to streamline one’s writing of beautiful essays.
Git tracking differs from staging
I learned some Git principles and judo: tracking differs from staging: i.e.git commit -a stages and commits already-tracked files, and new files won’t be committed; git add . tracks and stages. by definition, files are tracked only when they are first staged/committed. There is no “track but not stage” for new files git diff is “staged - working directory”. git diff –staged is “commit - staged”. git status -s gives a concise description of what’s untracked, modified, and whether the modification is staged or not.