Authorization: Bearer TOKEN

You can authorize http requests in four main ways: Two involve the Authentication header, two involve request parameters. You can use a 1) Basic or 2) Bearer Authentication header, or you can pass a token/un-pass combo to a 3) query paramater or 4) form parameter. The value of the Authorization header is a space-delimited tuple. As an http newbie, I wondered how to pass authorization tokens in. Do I pass another token in?

Bitcoin/Dogecoin use a UTXO model to see how much you have

Crypto is weird. With it, you really spend transactions labeled with coin values (UTXOs) and not coins themselves. The blockchain uses an Unspect Transaction Outputs model a.k.a. a UTXO model to calculate what a person’s able to spend. Assume a brand new network which genesises three transactions–1BTC, 0.5BTC, 2BTC–for 3 UTXOs. Someone else joins the network, and you decide to pay him 0.25BTC. Like pulling a $5 from your wallet, you pull one UTXOs and give it to the network, probably the 0.

Paper wallet fundamentals

A wallet is a container for pairs of strings. You can have 2, 4, 6… 2n strings in a valid wallet. The two strings of each pair are a public hash string and a private hash string. Why both and not just private hash strings? Without the public, the software it’ll eventually work with won’t know which address to unlock coins for (“key” is a bad metaphor; the public key is more like a lockbox, and the private key is more like a key).

Reitit course starts with a Hello World app template, not the Cheffy app template.

I handled three misconceptions with Jacek’s Reitit course: It’d use the Re-Frame cheffy files off the bat, showing a proper webpage on Heroku; that the Heroku server’d use the latest Leiningen; and that heroku create initialized the git repo. lein new app cheffy creates a hello world project from the “app” template. It doesn’t pull cheffy as a template. Leiningen defaults to 1.7 which does not use https when pulling from Clojars or Maven causing checksum errors when the servers 501 (https required).

Re-Frame interceptor errors prevent app state updates

One error in any interceptor prevents the second Re-Frame domino from falling. Either I wrote an error or clojure.spec changed since Jacek recorded his course, but my spec saw the db and threw an error. My spec function was in an interceptor, and this interceptor error prevented Re-Frame from updating the app-db, causing nothing to load in the app. Any error in any interceptor (including after interceptors) of an event handler will prevent app state updates and further effects.

When an event-fx dispatches to an event-db, pull the event-db's op to the original event-fx and change it to event-db

In Re-Frame, I removed effect events for db events. Pure db events represent low cognitive-overhead functional programming: db in, db out. Side effect fx events necessarily complicate the program, but per Jacek Schae’s instruction, I removed unnecessary cases: I.e. fx events that dispatched to db events. I changed these db-dispatching fx events to a db event and have it modify the db one more time in a db event instead of dispatching.

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?