By neildaemond, an 'any-stack' hacking grasshopper.
Taking notes while tinkering with:
The elm architecture is explained in the Elm guide, but I’m going to try and break it down in a way in which I understand it so that hopefully anyone reading here can benefit from another perspective.
The guide tells us that an Elm application has the architectural pattern of Model-Update-View but, what does this mean? I see it like this:
I had an html table of categorized items, and I wanted to give each category it’s own Color automatically. So I thought I’d hash the category ID String into an HTML Hexidecimal Color. A search will find this stack overflow post, but I was using elm and thought it would be a fun task to translate this function into a funcitonal style. Here’s how that went:
Wow, I can’t believe it’s been 3 years since my last ‘Hacker Dad’ post. And guess what, I’m still trying to find the time to work on self-motivated projects for fun, learning and profit. Granted, I’ve had a second kid (a daughter) 16 months ago, so that reset the countdown until they are more manageable.
I DID get to do some fun DIY for her 1st Birthday, However.
I’ve really been enjoying my recent experience with the front end (functional) programming language called Elm for the following reasons:
The Elm Architecture is great for single page apps (SPAs) as the rendered view will update automatically depending on the data model which gets manipulated when events are triggered.
Immutable variables and Strong typing produces reliable and readable code, although slightly trickier to write (at first).
The compiler is extremely smart and helpful (and a bit strict), often telling you exactly what went wrong and where to find it. Compiled Elm apps have slogan of “No Runtime Errors” since the Strict Typing allows the compiler to ensure there will not be any.
Here is my guide to getting started (with vim as my IDE):
the following commands mentioned on this post on stackoverflow can generate base64 encoded image for use in html.
type=$(identify -format "%m" "$file" | tr '[A-Z]' '[a-z]')
echo "data:image/$type;base64,$(base64 -w 0 "$file")"
git log --graph --oneline --decorate --branches