Today I learned
Today I stumbled upon Atomic Design. It is some kind of architectural pattern for the user interface. The goal is to build a reusable UI that is easy to understand and maintain.
It starts with atoms, which represent the smallest units of the UI like text, buttons or images. By composing atoms, you get molecules like a search input (label, input, button). Then there are organisms like the top navigation bar. Templates align organisms. In the end, Pages fill the templates with acutal data.
From my perspective, only the Pages connect to non-UI parts of the application. Hence the Atomic Design is only focused about the structure of the view.
With OPA you implement decisions of policies, not their enforcement. This avoids confusion between multiple servers that might come from different implementations of the policies.
The decisions themselves are implemented using the Regi programming language.
Similar to Prolog, Rego is a declarative and logic programming language. A seldom choice, but a great fit for policies!
You can override Go values with ldflags during the build.
That way, you can inject values like the current version, build date or the current commit hash.
go build \ -ldflags "-X 'github.com/metal-stack/v.Version=$(VERSION)' \ -X 'github.com/metal-stack/v.Revision=$(GITVERSION)' \ -X 'github.com/metal-stack/v.GitSHA1=$(SHA)' \ -X 'github.com/metal-stack/v.BuildDate=$(BUILDDATE)'" \
Seen in the metal-stack/v repository.
All the hosted Kubernetes solutions I know of want you to pay roughly 10$ pre month for each load balancer.
If you currently don’t expect much traffic, but want to play around with k8s or if many docker-compose files don’t fit your needs anymore, this easily doubles your costs.
Bonus learning: I didn’t heard of the
I have been playing around with minikube for quite some time now. Though as I run minikube on my Mac, I experienced multiple bugs regarding accessing the cluster and it’s published ports.
From my perspective Kind works much better, is faster, more stable on macOS and allows the creation of multiple clusters. Though it is not bug-free on macOS. Although most bugs seem to be related to Docker itself on the Mac.
You can even pause the cluster - just pause it’s docker container.
I gave the newest tool of Charm Gum a try. It allows to create interactive bash scripts in just a few lines of code.
In my case I gave it a try for Kubernetes. I often want to look at the logs of a pod, but the exact k8s pod differs from time to time. And sometimes I forget the exact namespace or the pod’s name includes random characters.
#! /bin/bash # let the user select a namespace NAMESPACE=$(kubectl get namespaces -o name | gum choose | cut -d/ -f2) # let the user select a pod of the namespace POD=$(kubectl get pods -n "$NAMESPACE" | tail -n +2 | gum choose | cut -d' ' -f1) # if you want to repeat, copy the command echo "> kubectl logs -n \"$NAMESPACE\" \"$POD\"" # print the logs kubectl logs -n "$NAMESPACE" "$POD"
Go 1.19 introduced a new option to customize the runtime Garbage Collection behavior: Memory Limit. This might be interesting when embedding Go within a mobile application.
When using tailwind, you might be forced to manually write SCSS by hand.
@apply some classes; you can embed whole classes with all their styles into your own rules.
But sometimes you need to only acces one single constant. Like accessing an animation timeout, default paddings, fonts or a color for some cases.
That’s possible with a simple
If you need assets for a specific document or blog post, you can simply create a folder with your desired name and place your assets in there. Rename the markdown file to
To reference the asset, just link it relative to the folder
The underlying library is available as Go module github.com/alecthomas/chroma.