today i learned
css inset
I’ve been writing left: 0; right: 0; top: 0; bottom: 0 this whole time but it turns out inset: 0 is a shorthand for that. You can even do inset: <top> <right> <bottom> <left> just like it’s margin or padding or something.
The original css had left and friends, but it took until baseline 2021 to unify it with margin/padding it seems.
groovy strings
I’ve heard a lot that you should use single-quoted strings in Groovy scripts (like gradle buildscripts) to save memory, since those compile to java.lang.String instead of the fancy groovy string class.
This isn’t strictly true https://docs.groovy-lang.org/docs/groovy-4.0.32/html/documentation/#_double_quoted_string
Double-quoted strings are plain
java.lang.Stringif there’s no interpolated expression, but aregroovy.lang.GStringinstances if interpolation is present.
arrays
java 9 added fancy stuff to “Arrays”: lexicographic comparison functions, mismatch functions (find the index of the first differing element). they use a fancy vectorized algorithm. there’s also other fun stuff in there like sorting, sorting in parallel, “setAll” (for building arrays as a function of their index), a weird function called “parallelPrefix” which is kind of like a reduction but leaves all the intermediates, deepToString etc