vknabel
Unlinke many other static site generators, the syntax highlighting of Hugo does not use client-side JavaScript, which is great!
The underlying library is available as Go module github.com/alecthomas/chroma.
You can override internal Hugo templates with your own templates.
Simply create it in the layouts
folder and you are done!
That’s how I overrode _internal/google_analytics_async.html
with my own template - to not use GA!
That way I could avoid forking athul’s archie template.
In Hugo you can simply create a folder within content/
and a template within layouts/_default/
. It will be used for the index route of that folder - even if your template did not specify a layout.
This allowed me to create a separate template for all my learnings / til section!
I created a GitHub workflow to automatically build and deploy my website to GitHub Pages.
It uses peaceiris/actions-hugo@v2 to build the website with Hugo and peaceiris/actions-gh-pages@v3 to deploy it to GitHub Pages.
When iterating over an array of objects in Angular, the change detection compares the references of the objects to detect changes.
If the object reference now change too, like when updating local data from the network, Angular will discard the identity of all nested components within the ngFor
and re-render the entire list. Even if the objects deeply equal, the change detection will still detect the change.
To help our loop caching components and instead changing their inputs, we can add a trackBy
function to the ngFor
directive.
<div
class="checkbox-row"
*ngFor="let option of field.options; trackBy: fieldOptionTrackBy"
></div>
And in TypeScript, we add identity tracking function:
fieldOptionTrackBy(index: number, option: AssistantStepOption): string {
return option.identifier;
}
Background: Angular did reset my
mat-checkbox
within thengFor
. That lead to a discard of the freshly changed values.
You can run your Go program or your tests with the Data Race detection enabled. This might cost some performance and memory, but in case a data race is being detected, that’s worth it!
Perfect for your CI!
go run --race ./cmd/app
go test --race ./...
I have never done anything productive with Kubernetes before. But it is a really tough topic to get started with. It’s overwhelming.
Luckily I found an excellent Kubernetes tutorial on Youtube.
I made some personal notes while watching. Mostly to keep some overview for all the different concepts.
Today I haven’t finished the video, so the overview is only a rough draft. Some missing concepts are Storage Classes, Ingress Controllers and more!
StatefulSets are like Deployments, but stateful.
StatefulSet has volume claim templates, to create independent storage for each replica.
volumeClaimTemplates
create a volume claim for each replica.
Master nodes and worker nodes are kept separate to keep the cluster controllable. Imagine you couldn’t manage your cluster to increase the number of worker nodes or replicas.
Worker Nodes Runs multiple pods.
3 processes are running on each node:
Master Nodes Manage the worker nodes.
Runs 4 processes:
Iterating over a map in Go is not predictable. This is a design decision to avoid relying on memory layout.
for k, v := range map {
// always prints different results!
fmt.Printf("%s: %s\n", k, v)
}
I had completely forgotten about NSDataAsset. Maybe I should move some of my JSON files into asset catalogs. According to @emergetools that should remove some code signing overhead from the app size.
When using auto layout with a UIScrollView
, subviews may not attach to the top edge of the scroll view’s parent. Else you cannot scroll, but the handle shrinks the more you scroll.
Setting left and right is ok to fix the width if you do not plan to scroll horizontally.