mafinar

mafinar

ClojureScript + LiveView

I did not add this to a “this weekend I’ll learn” like my few other journals as I am decided on using this in the long term.

Last I worked with Clojure was first around 2011 (for a few months, to implement a TCP server but other programmers revolted and had to move to Netty + Java) and then ClojureScript in 2014, (with ClojureScript + Reagent, I actually learned Reagent before React), that stretched almost a year, but again, the other developers revolted and wanted to use Angular instead (I know right?), so that was just one project.

Last weekend while trying to embed Alpine 3 to my project, combined with dependa bot alerts, I wondered if I could go without “Webpack” and used “Parcel” instead, in the spirit of science, I did that and it went smooth. Alpine 3 worked too, seems like I needed Webpack 5 or something (but I am past caring about that now). Then it occured to me, hey, remember ClojureScript? Why not try that out, since I had enough JS fatigue for the hour?

I went on to Clojure land and discovered this thing called Shadow CLJS, along with some cool things like Spec, Transducers etc, folks were busy! So, I surfed the web for articles, found one, and with it, I converted my app.js to src/main.cljs, wrapped all my hooks with (deftype)-s, and an hour or two later, it worked!

I did keep the Parcel though, because I did not know how to copy SCSS in ClojureScript (yet).

Last weekend was a blast, sure, I worked hard. But when things failed, they had logical reasoning for it. And while Elixir and the Lisp are different on the surface, the data centric idea remained similar. So it was context switching without context switching for me. I had three hooks, some charts and a heat map, those were promptly converted. Wasn’t as easy as they were when I first made them, but was much more fun, and readable. Good times.

Therefore I decided to stick to it. This project will get more hooks, so more cljs coming along the way. My other project KarmaWerks (A LiveView + DGraph + JS ClojureScript) is getting a revival next month. And my short bike tracking weekend work (MilesToGo - realtime personal location tracking app something I want to track my next month’s vacation/hiking with) is going to keep me occupied during the weekends. All Open Source things! So lots of fun coming our way!

So here’s what I’ll do. I’ll update my work progress in this place. I will work with KarmaWerks AFTER I am done with a smallest workable unit of MilesToGo, the Covid19 dashboard is like somewhat workable already and is used as the experimentation field for the whole thing. I’ll speak on progress of whatever it is I am working with at the time. To remind myself of how things were should I get back to them after 2 years!

And before I leave, my gratitude to the authors of the two articles that helped me set up Parcel and ClojureScript with Phoenix:

  1. https://www.dwolla.com/updates/webpack-to-parcel/ (Setting up Parcel + Phoenix)
  2. https://darioghilardi.com/how-to-setup-a-phoenix-and-clojurescript-project/ (Setting up ClojureScript + Phoenix)

Thank you for getting me set-up without having to scratch my head.

Popular Backend topics Top

PragmaticBookshelf
Go is a modern programming language that combines the reliability of compiled languages with the ease of use and flexibility of dynamic t...
New
PragmaticBookshelf
Machine learning can be intimidating, with its reliance on math and algorithms that most programmers don't encounter in their regular wor...
New
PragmaticBookshelf
Don’t accept the compromise between fast and beautiful: you can have it all. Phoenix creator Chris McCord, Elixir creator José Valim, and...
New
AstonJ
Another BEAM language… The Hamler Programming Language Hamler is a strongly-typed language with compile-time typechecking and built-in...
New
Jsdr3398
I just thought of this. Are there any disadvantages when making your server in Assembly (other than having to learn a bunch of stuff :ro...
New
DevotionGeo
What do you people do for reading Erlang docs? Is there something like Ruby’s ri? I installed manual pages for Erlang under /usr/local/...
New
First poster: bot
Node.js v14.19.0 has been released. Link: Release 2022-02-01, Version 14.19.0 'Fermium' (LTS), @richardlau · nodejs/node · GitHub
New
JimmyCarterSon
Hello, I am working on a new application with Elixir, Dish_out. I want to see Data I follow this tutorial with Elixir Casts. However, I ...
New
New
First poster: bot
Node.js v18.16.0 has been released. Link: Release 2023-04-12, Version 18.16.0 'Hydrogen' (LTS), @danielleadams · nodejs/node · GitHub
New

Other popular topics Top

AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
Rainer
Not sure if following fits exactly this thread, or if we should have a hobby thread… For many years I’m designing and building model air...
New
gagan7995
API 4 Path: /user/following/ Method: GET Description: Returns the list of all names of people whom the user follows Response [ { ...
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
First poster: bot
The overengineered Solution to my Pigeon Problem. TL;DR: I built a wifi-equipped water gun to shoot the pigeons on my balcony, controlle...
New
PragmaticBookshelf
Author Spotlight Rebecca Skinner @RebeccaSkinner Welcome to our latest author spotlight, where we sit down with Rebecca Skinner, auth...
New
New
PragmaticBookshelf
Author Spotlight: VM Brasseur @vmbrasseur We have a treat for you today! We turn the spotlight onto Open Source as we sit down with V...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New