Weekly Brain Dump #1
What Is This?
I thought it could be some fun to do a brain dump each week of all the technical stuff that went through my head and maybe even out through my fingers.
But it’s Thursday?
- you probably
Yeah, this is the best night for me to polish something like this off and get it done. I feel Friday is already too stacked and Sunday I’m way too tired. So set your watches for Thursday to see what’s up with me.
At a Glance
- LocalCI: My most recent project nears usable
- Harper: A language server for English
- Mithril.js: The JavaScript front end library I love
- js.html-builder: A DSL for writing HTML in JavaScript
- Sunbeam: The coolest CLI launcher
LocalCI
I’ve been having a blast working on LocalCI this past couple of weeks. It’s gone from an empty folder to a usable continuous integration (CI) system.
I spent the first few days moulding the idea in my head. This is something I’ve really been pushing myself to do more every time I think of starting a new project. I force myself to actually write out a plan in either a plain Markdown file or sketch out the architecture in Excalidraw. I’ve found this has cut down on me starting a billion little projects. This is what helped me realise I could save a huge amount of time building this on top of Rake instead of reimplementing such a complicated tool myself.
Right now I’m in the process of implementing it in a couple of my more mature projects to see if it holds up to real world use cases. I’m hitting some interesting issues. Mostly it’s due to the fact I’m implementing it in Neospec and there are a lot of Docker images in play. Also because I’m having to change the way the whole CI suite works since it’s not just asdf in the Buildkite Docker image.
The most fun part of it was using a Ruby Thread to keep it updating in real time while the tasks in the background run.
Harper
Specifically harper-ls in Neovim. If you see any – that’s because it told
me off for using --, I don’t use any “AI” but I want to try to write better.
I’m aware that’s a big red flag of using “AI” but it’s also part of the English
language.
I set this up mostly because I saw it linked somewhere, I don’t remember whereas I’m writing this several days after so that is gone. I’ve tried a handful of tools like this in the past but nothing has ever stuck. We will see if this one stands the test of time but so far I’m liking it. Especially since I can turn off things I genuinely don’t care about.
This sort of tool has been on my radar again as I plan to do more documentation once I get LocalCI up to a point I think it’s ready for others. Also Taylor Engine has lots of documentation already and I’ve seen myself make a lot of mistakes there.
My Neovim config is below.
vim.lsp.config('harper_ls', {
on_attach = on_attach,
settings = {
["harper-ls"] = {
dialect = "Australian",
linters = {
ExpandMinimum = false,
Spaces = false,
SpellCheck = false,
},
},
},
})
vim.lsp.enable('harper_ls')
Mithril.js
Mithril.js has been on my mind again and I’m really tempted to replace my usage of HTMX in The Write Clean. By the time this comes out I may have done so.
It’s a really nice library that is – surprisingly – still maintained by a small but dedicated community.
js.html-builder
Thursday morning I was wondering if anyone had built a JavaScript equivalent
of Phlex or Papercraft. To save you a click, Phlex is a library for Ruby
that lets you write HTML using a nice Ruby Domain Specific Language
(DSL). The benefit of this over ERB is that it’s not a templating language,
you’re just writing Ruby. There’s no awkward <%= %> which is a pain to type
over and over again. Although for me the biggest win is formatting works nicely.
I have never figured out a style of ERB formatting that I like. Another big perk
is testing is way easier.
Obviously JavaScript as a language makes writing a nice DSL harder because you can’t drop the parenthesis and blocks have to be typed out as anonymous functions.
I did find js.html-builder which looks like an experimental project that you should absolutely not use in production but is interesting nonetheless.
For instance in Papercraft you would write a basic document like below.
Papercraft.html {
html {
head { title "Hello World" }
}
body {
h1 "Hello"
p "World"
}
}
But in js-html you would write a basic document like below.
const code = () =>
html(() => {
head(() => title('Hello World'))
body(() => {
h1('Hello')
p('World')
})
})
I think they’ve done a pretty damn good job at making a nice DSL using JavaScript and honestly I wouldn’t mind using this over JSX if it were a more mature and battle tested library.
Needless to say I shall not be using this in any of my projects but I’m really glad I found this. It has prevented me from writing it myself as I was very tempted.
Sunbeam
Sunbeam is an incredibly cool tool. It’s a command line interface launcher. I had a bit of a play with it but don’t think it fits into my workflow. There are use cases for it but I think – for me specifically – it doesn’t provide value.
I will absolutely keep it in the back of my mind just in case that ever changes because I want to use this tool. It’s just that cool.