Today I learned

Extracting Tailwind constants using theme

When using tailwind, you might be forced to manually write SCSS by hand. With @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 theme('colors.primary').

Angular *ngFor trackBy

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.

  *ngFor="let option of field.options; trackBy: fieldOptionTrackBy"

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 the ngFor. That lead to a discard of the freshly changed values.

Iterating over a map in Go

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)

NSDataAsset reduces Code signing overhead

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.

Tweet by @simonbs

Attaching to UIScrollView's parent with Auto Layout

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.

SwiftPM can detect breaking api changes

Starting with Swift 5.6 the Swift Package Manager can automatically detect Breaking API changes. Really great for libs!

Missing Async XCTests on Linux

Async tests do not work on Linux, only on macOS. Instead you need to implement a helper function that runs the test async by relying on expectations.

WKWebView Configuration Cookies not working

Cookies in WKWebView are broken. When manually setting a Cookie using the Configuration, it will be ignored by the web view.

Workaround: add a UserScript with the following code:

document.cookies = 'cookie_optin=essential:1|analytics:0'

That’s a great way to automatically reject Cookies and especially to disable tracking to either propagate the user’s ATT decision or to avoid implementing ATT in the beginning.

Getting your IP address

Sometimes you need your local IP address on the command line to automatically pass it to a script.

ifconfig en0 |awk '/inet / {print $2; }'

Swift custom table of contents lib

If the default Table Of Contents / Index Set for iOS does not fit your use cases. This library might be interesting: