Weekly Brain Dump #34
At a Glance
- Replace JavaScript with Ruby I continue my madness of using Ruby in the browser
- Interesting Links Cool things I found this week
- Comments
Replace JavaScript with Ruby
I’ve spent the little time I’ve had spare this past week fiddling with this project and have made surprising progress!
Using OpalRB, Mithril, and Bulma I have built an extremely nice way to build interactive browser applications. The payload is a little heavy off the bat but I feel the improved developer experience is worth it for what I’m doing, which is mostly distributing desktop applications where the penalty for larger files is greatly reduced.
I’m currently making this a gem and giving a serious test by implementing a real
project using it. I’m creating more widgets for my writing streamer widget pack.
I’ve only just got it to the point where I’m seriously implementing something
but so far I’m excited. The following is the code for the Counter
components you see below.
Mithril::Component.define(:Counter) do
oninit do
state[:count] = 0
end
view do
nav(class: "card") {
header(class: "card-header") {
p(class: "card-header-title") {
plain "Counter"
}
}
div(class: "card-content") {
div(class: "block") {
plain "Current count: #{state[:count]}"
}
}
div(class: "card-footer") {
a(
class: "card-footer-item",
onclick: ->(e) {
e.JS.preventDefault
state[:count] -= 1
},
href: "#"
) { plain "-" }
a(
class: "card-footer-item",
onclick: ->(e) {
e.JS.preventDefault
state[:count] = 0
},
href: "#"
) { plain "Reset" }
a(
class: "card-footer-item",
onclick: ->(e) {
e.JS.preventDefault
state[:count] += 1
},
href: "#"
) { plain "+" }
}
}
end
end
Needless to say I’m very excited by this and it has kept programming fun during some hard times. If nothing else I think that’s incredibly valuable. I’ll release the code at some point for the gem I’m building but that probably won’t be for a while.
Interesting Links
The Lua community needs to learn to move on: It's crazy that people keep relying on such old versions and expecting support.
Defeating Nondeterminism in LLM Inference: This contained lots of things I didn't know about how computers deal with floating point numbers.
rust-lang/rust is adopting an LLM policy: Quite a good policy on LLMs by the rust team, it basically boils down to "Humans need to understand the code, no exceptions"
Develop Cross-Platform CLI and GUI Tools With Tcl/Tk. Powerful, Event-Driven, Open-Source And Future-Proof Toolkit… From the Past?!: I had no idea Tcl/Tk was so powerful and still actively maintained.
Running code when the Ruby on Rails webserver boots: Surprisingly trickier than you'd think.