<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Smagin</title>
    <link>https://smagin.fyi/posts/</link>
    <description>Sergei Smagin writes a blog. Expect takes on design, random programming topics, personal finance tool devlog.</description>
    <generator>Hugo 0.170.1</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 16 Aug 2026 08:20:41 +0200</lastBuildDate>
    <atom:link href="https://smagin.fyi/posts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Popovers</title>
      <link>https://smagin.fyi/posts/popovers/</link>
      <pubDate>Sun, 16 Aug 2026 08:20:41 +0200</pubDate>
      <guid>https://smagin.fyi/posts/popovers/</guid>
      <description>&lt;p&gt;Here is what I know about popovers.&lt;/p&gt;
&lt;h2 id=&#34;most-of-popovers-are-avoidable&#34;&gt;Most of popovers are avoidable&lt;/h2&gt;
&lt;p&gt;Or, to put it strongly, popover is the most stupid thing you can do (&lt;a href=&#34;https://bureau.ru/books/ui/336&#34;&gt;in Russian, use browser translation&lt;/a&gt;). Really, putting content into a popover doesn&amp;rsquo;t require you to think how to put it on the screen. So, with some effort, most of the content could either become their own pages or put into existing pages.&lt;/p&gt;
&lt;p&gt;I have to mention &lt;a href=&#34;https://daringfireball.net/2026/05/what_is_a_dickover&#34;&gt;dickovers&lt;/a&gt; here. Surely if you&amp;rsquo;re making them you know what you&amp;rsquo;re doing and it has nothing to do with good UX.&lt;/p&gt;
&lt;p&gt;This part reads as a disclaimer but really the first thing I would do before adding a popup is trying not to add it.&lt;/p&gt;
&lt;h2 id=&#34;popovers-dont-have-to-be-modal&#34;&gt;Popovers don&amp;rsquo;t have to be modal&lt;/h2&gt;
&lt;p&gt;Or, backdrop is optional. A rule of thumb: try bending the popover behaviour so it&amp;rsquo;s better without a backdrop. Can we save changes right away if people edit the content inside of it? Can we show the popover the way it doesn&amp;rsquo;t hide the main page content?&lt;/p&gt;
&lt;p&gt;Take notion sidebar. I guess it&amp;rsquo;s technically pop-aside, but it makes what is otherwise two pages one, moves the &amp;ldquo;referrer&amp;rdquo; page slighly left and opens a new page on the right. Left page is not covered with a backdrop and keeps working as usual. You can replace the right page content clicking anything else.&lt;/p&gt;
&lt;p&gt;Logseq extends this pattern and has a whole right area where you can open multiple pages one before another. All pages work, they are just sort of in a layout.&lt;/p&gt;
&lt;p&gt;Another example is tooltips. Though they often show things that could be on the page from the start, they don&amp;rsquo;t prevent you from using the rest of the page.&lt;/p&gt;
&lt;h2 id=&#34;no-popovers-inside-popovers&#34;&gt;No popovers inside popovers&lt;/h2&gt;
&lt;p&gt;(except tooltips that also should be shown at most one at a time)&lt;/p&gt;
&lt;p&gt;Hint: you can make it technically impossible to display multiple popovers at once. This will save you from a whole class of bugs. Multiple popovers never look good, so if you catch yourself thinking you need a popover inside a popover &amp;ndash; you don&amp;rsquo;t. That&amp;rsquo;s one strong opinion I have and don&amp;rsquo;t want to explain much. Call it another rule of thumb, but here is &lt;a href=&#34;https://grumpy.website/search?q=popup&#34;&gt;a gallery&lt;/a&gt; of how wrong it may look.&lt;/p&gt;
&lt;h2 id=&#34;good-popovers-have-helpers-on-the-server-side&#34;&gt;Good popovers have helpers on the server side&lt;/h2&gt;
&lt;p&gt;One day you&amp;rsquo;ll want your popover to fetch content before rendering it. Tricks that I know to make the behaviour of it least surprising:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A link to such a popover should be an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; link.&lt;/li&gt;
&lt;li&gt;Server should know that a link to a popover was clicked, and not a normal one, to return just html that should be changed. In Ruby on Rails we do it using turbo_stream format that is a wrapper on top of ajax. There is a &lt;a href=&#34;https://hotwired.dev/&#34;&gt;whole site&lt;/a&gt; about it. HTMX does &lt;a href=&#34;https://four.htmx.org/docs#multi-target-updates&#34;&gt;the same&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;When this link is clicked as &amp;ldquo;open in new tab&amp;rdquo;, it at a minimum shouldn&amp;rsquo;t fail. Ideally it should either render the popover content as a full page (then you have to answer yourself why didn&amp;rsquo;t you do it in all cases) or render an entire page from which a popover was triggered in the background.&lt;/li&gt;
&lt;li&gt;If you went with rendering the entire page, you probably want to replace the browser URL to that background page URL.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;where-and-when-to-show-popovers-how-to-hide-them&#34;&gt;Where and when to show popovers, how to hide them&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve seen a few options, each has their complications and advantages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;attached to the caller (like tooltips) &amp;ndash; requires to manage the placement of the popover, allows content of virtually any shape&lt;/li&gt;
&lt;li&gt;sidebar &amp;ndash; covers full height and some half width, prompts to use all the space, and make it work with the caller page. Could be on the top or the bottom too.&lt;/li&gt;
&lt;li&gt;window in the center of the page &amp;ndash; biggest chance to be modal, wants to be important enough to break the flow. Allows to shift layout as you like, see any command palette.&lt;/li&gt;
&lt;li&gt;fixed part of the page not attached to anything &amp;ndash; I&amp;rsquo;m talking about e.g. search prompt in chrome that appears on cmd+f. It always appears at the same place when you call it, it doesn&amp;rsquo;t prevent you from working with the page, but the place is seemingly random. Flash messages are in this category as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Popovers usually open on click, hover or by a hotkey, and closed by clicking esc or a designated button. If there is a backdrop, clicking it should close the popover.&lt;/p&gt;
&lt;p&gt;Pics:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;sidebar and tooltip&#34; src=&#34; /pics/popovers-sidebar-tooltip.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;command palette&#34; src=&#34; /pics/popovers-command-palette.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;search and menu&#34; src=&#34; /pics/popovers-search-menu.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://bureau.ru/books/ui/336&#34;&gt;Popup is the most stupid thing you can do&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://daringfireball.net/2026/05/what_is_a_dickover&#34;&gt;Dickover&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Grumpy website collection of popups (mostly next to or inside popups) &lt;a href=&#34;https://grumpy.website/search?q=popup&#34;&gt;https://grumpy.website/search?q=popup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Hotwire is an approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire. &lt;a href=&#34;https://hotwired.dev/&#34;&gt;https://hotwired.dev/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In a non-rails world, HTMX is doing a similar job. &lt;a href=&#34;https://htmx.org/&#34;&gt;https://htmx.org/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
      <content:encoded>&lt;p&gt;Here is what I know about popovers.&lt;/p&gt;
&lt;h2 id=&#34;most-of-popovers-are-avoidable&#34;&gt;Most of popovers are avoidable&lt;/h2&gt;
&lt;p&gt;Or, to put it strongly, popover is the most stupid thing you can do (&lt;a href=&#34;https://bureau.ru/books/ui/336&#34;&gt;in Russian, use browser translation&lt;/a&gt;). Really, putting content into a popover doesn&amp;rsquo;t require you to think how to put it on the screen. So, with some effort, most of the content could either become their own pages or put into existing pages.&lt;/p&gt;
&lt;p&gt;I have to mention &lt;a href=&#34;https://daringfireball.net/2026/05/what_is_a_dickover&#34;&gt;dickovers&lt;/a&gt; here. Surely if you&amp;rsquo;re making them you know what you&amp;rsquo;re doing and it has nothing to do with good UX.&lt;/p&gt;
&lt;p&gt;This part reads as a disclaimer but really the first thing I would do before adding a popup is trying not to add it.&lt;/p&gt;
&lt;h2 id=&#34;popovers-dont-have-to-be-modal&#34;&gt;Popovers don&amp;rsquo;t have to be modal&lt;/h2&gt;
&lt;p&gt;Or, backdrop is optional. A rule of thumb: try bending the popover behaviour so it&amp;rsquo;s better without a backdrop. Can we save changes right away if people edit the content inside of it? Can we show the popover the way it doesn&amp;rsquo;t hide the main page content?&lt;/p&gt;
&lt;p&gt;Take notion sidebar. I guess it&amp;rsquo;s technically pop-aside, but it makes what is otherwise two pages one, moves the &amp;ldquo;referrer&amp;rdquo; page slighly left and opens a new page on the right. Left page is not covered with a backdrop and keeps working as usual. You can replace the right page content clicking anything else.&lt;/p&gt;
&lt;p&gt;Logseq extends this pattern and has a whole right area where you can open multiple pages one before another. All pages work, they are just sort of in a layout.&lt;/p&gt;
&lt;p&gt;Another example is tooltips. Though they often show things that could be on the page from the start, they don&amp;rsquo;t prevent you from using the rest of the page.&lt;/p&gt;
&lt;h2 id=&#34;no-popovers-inside-popovers&#34;&gt;No popovers inside popovers&lt;/h2&gt;
&lt;p&gt;(except tooltips that also should be shown at most one at a time)&lt;/p&gt;
&lt;p&gt;Hint: you can make it technically impossible to display multiple popovers at once. This will save you from a whole class of bugs. Multiple popovers never look good, so if you catch yourself thinking you need a popover inside a popover &amp;ndash; you don&amp;rsquo;t. That&amp;rsquo;s one strong opinion I have and don&amp;rsquo;t want to explain much. Call it another rule of thumb, but here is &lt;a href=&#34;https://grumpy.website/search?q=popup&#34;&gt;a gallery&lt;/a&gt; of how wrong it may look.&lt;/p&gt;
&lt;h2 id=&#34;good-popovers-have-helpers-on-the-server-side&#34;&gt;Good popovers have helpers on the server side&lt;/h2&gt;
&lt;p&gt;One day you&amp;rsquo;ll want your popover to fetch content before rendering it. Tricks that I know to make the behaviour of it least surprising:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A link to such a popover should be an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; link.&lt;/li&gt;
&lt;li&gt;Server should know that a link to a popover was clicked, and not a normal one, to return just html that should be changed. In Ruby on Rails we do it using turbo_stream format that is a wrapper on top of ajax. There is a &lt;a href=&#34;https://hotwired.dev/&#34;&gt;whole site&lt;/a&gt; about it. HTMX does &lt;a href=&#34;https://four.htmx.org/docs#multi-target-updates&#34;&gt;the same&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;When this link is clicked as &amp;ldquo;open in new tab&amp;rdquo;, it at a minimum shouldn&amp;rsquo;t fail. Ideally it should either render the popover content as a full page (then you have to answer yourself why didn&amp;rsquo;t you do it in all cases) or render an entire page from which a popover was triggered in the background.&lt;/li&gt;
&lt;li&gt;If you went with rendering the entire page, you probably want to replace the browser URL to that background page URL.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;where-and-when-to-show-popovers-how-to-hide-them&#34;&gt;Where and when to show popovers, how to hide them&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;ve seen a few options, each has their complications and advantages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;attached to the caller (like tooltips) &amp;ndash; requires to manage the placement of the popover, allows content of virtually any shape&lt;/li&gt;
&lt;li&gt;sidebar &amp;ndash; covers full height and some half width, prompts to use all the space, and make it work with the caller page. Could be on the top or the bottom too.&lt;/li&gt;
&lt;li&gt;window in the center of the page &amp;ndash; biggest chance to be modal, wants to be important enough to break the flow. Allows to shift layout as you like, see any command palette.&lt;/li&gt;
&lt;li&gt;fixed part of the page not attached to anything &amp;ndash; I&amp;rsquo;m talking about e.g. search prompt in chrome that appears on cmd+f. It always appears at the same place when you call it, it doesn&amp;rsquo;t prevent you from working with the page, but the place is seemingly random. Flash messages are in this category as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Popovers usually open on click, hover or by a hotkey, and closed by clicking esc or a designated button. If there is a backdrop, clicking it should close the popover.&lt;/p&gt;
&lt;p&gt;Pics:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;sidebar and tooltip&#34; src=&#34; /pics/popovers-sidebar-tooltip.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;command palette&#34; src=&#34; /pics/popovers-command-palette.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;search and menu&#34; src=&#34; /pics/popovers-search-menu.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://bureau.ru/books/ui/336&#34;&gt;Popup is the most stupid thing you can do&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://daringfireball.net/2026/05/what_is_a_dickover&#34;&gt;Dickover&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Grumpy website collection of popups (mostly next to or inside popups) &lt;a href=&#34;https://grumpy.website/search?q=popup&#34;&gt;https://grumpy.website/search?q=popup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Hotwire is an approach to building modern web applications without using much JavaScript by sending HTML instead of JSON over the wire. &lt;a href=&#34;https://hotwired.dev/&#34;&gt;https://hotwired.dev/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In a non-rails world, HTMX is doing a similar job. &lt;a href=&#34;https://htmx.org/&#34;&gt;https://htmx.org/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
    </item>
    <item>
      <title>Neovim colorscheme doesn&#39;t have to be about colors</title>
      <link>https://smagin.fyi/posts/more-boring-tomorrow/</link>
      <pubDate>Wed, 29 Jul 2026 09:49:27 +0200</pubDate>
      <guid>https://smagin.fyi/posts/more-boring-tomorrow/</guid>
      <description>&lt;p&gt;I have an nvim theme called Boring Tomorrow that highlights different things in and around the code than most of the themes. I have a &lt;a href=&#34;https://smagin.fyi/posts/colorscheme/&#34;&gt;post&lt;/a&gt; about it.&lt;/p&gt;
&lt;p&gt;I changed the theme recently to use terminal colors instead of colors set in neovim, splitting things I want to highlight from the the colors I like. Incidentally, this brings dark mode switch a problem of the terminal.&lt;/p&gt;
&lt;p&gt;TL;DR:&lt;/p&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colors-all.png&#34; alt=&#34;Different terminal colors with Boring Tomorrow highlight&#34; title=&#34;Different terminal colors with Boring Tomorrow highlight&#34; class=&#34;wide-image&#34; /&gt;
&lt;h2 id=&#34;terminals-support-hex-colors-it-doesnt-mean-i-should-use-them&#34;&gt;Terminals support hex colors, it doesn&amp;rsquo;t mean I should use them&lt;/h2&gt;
&lt;p&gt;In 2026, basically all terminals support all the same colors as browsers. It was an achievement when the standard was made and implemented. Before, it was just a limited set of colors and people just lived with them. I suggest we treat this limited set as a lucky state of the world where most of the apps will use colors from the same palette.&lt;/p&gt;
&lt;h3 id=&#34;digression-color-palettes-in-web&#34;&gt;Digression: Color palettes in web&lt;/h3&gt;
&lt;p&gt;&amp;hellip;do not exist globally. There are default styles and default color names, but you can&amp;rsquo;t bring your own palette and repaint the whole internet just for yourself. But, css is really flexible and vast, and people and companies definitely wanted to reuse styles for their different sites.&lt;/p&gt;
&lt;p&gt;I believe there is very little secret in how css works but in case you&amp;rsquo;re one of the &lt;a href=&#34;https://xkcd.com/1053/&#34;&gt;lucky 10 000&lt;/a&gt;, you can import a css on the website and it will be applied. Additionally, many people use standardised design tokens that include colors, fonts, and sizes. One abstraction layer on top of the tokens are components that are often specified with more than just css. If we only talk about color palettes, the most influential ones are from Bootstrap and Tailwind, but there are literally thousands out there. Julia Evans has &lt;a href=&#34;https://jvns.ca/blog/2026/05/04/css-colour-palettes/&#34;&gt;an opinionated collection&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the other side, people wanted to apply all sorts of patches for different sites just for themselves, and there is a word userstyles for the css part of that. Adblock is weirdly in the same group because annoying parts of the websites often deserve to be hidden rather than polished.&lt;/p&gt;
&lt;p&gt;So what I&amp;rsquo;m saying is, terminals are lucky to have a standard overridable set of colors. Web would be one dimension more flexible if it had a similar thing. There is one for fonts, if you set &lt;code&gt;font-family: serif&lt;/code&gt; browser will use the font from the browser settings. You can even force pages to use your fonts instead of whatever they do. It used to break icon fonts (wasn&amp;rsquo;t awesome of fontawesome) but icon fonts are out of fashion now and this option is not a joke anymore. To try in Firefox, uncheck &lt;code&gt;Fonts -&amp;gt; advanced -&amp;gt; Allow pages to choose their own fonts, instead of your selections above&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;16-colors-ought-to-be-enough&#34;&gt;16 colors ought to be enough&lt;/h3&gt;
&lt;p&gt;Terminals emulators are old. Important consequences of it are that they are severely backward-compatible, and that there are many CLI apps that want to be run on anything and use backward-compatible colors.&lt;/p&gt;
&lt;p&gt;For the purpose of having a global overridable color palette, there are 256 colors that are supported everywhere, and they are one way or another derived from 16: black, red, green, yellow, blue, magenta, cyan, white, and &amp;ldquo;bright&amp;rdquo; versions of them. So, you could say there are only eight basic colors but in practice you want to define 16 as foregrounds and backgrounds.&lt;/p&gt;
&lt;p&gt;To expand the palette to 256 colors you could use all the tricks you want. Traditional definition is an rgb cube:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# quoting the wikipedia page above
  0-  7:  standard colors (as in ESC [ 30–37 m)
  8- 15:  high intensity colors (as in ESC [ 90–97 m)
 16-231:  6 × 6 × 6 cube (216 colors): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5)
232-255:  grayscale from dark to light in 24 steps
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Web devs got nicer ways to generate palettes. There is a huge topic of color spaces, the current state of the art is oklch. We won&amp;rsquo;t dig into there, the only color we use from the extended palette is 255 for black, because black(0)+bold is drawn as gray according to some (same?) ancient protocol.&lt;/p&gt;
&lt;h3 id=&#34;making-a-terminal-colorscheme&#34;&gt;Making a terminal colorscheme&lt;/h3&gt;
&lt;p&gt;Aside of the colors already mentioned, there are more:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;background and foreground&lt;/li&gt;
&lt;li&gt;cursor background and foreground&lt;/li&gt;
&lt;li&gt;selection background and foreground&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;They belong to the colorscheme but are not accessible from the apps. There is an obvious reason for that, but it adds the assumption that all these colors match the rest of the palette. It&amp;rsquo;s not always the case, and e.g. wezterm even has an option to &lt;a href=&#34;https://wezterm.org/config/lua/config/text_min_contrast_ratio.html&#34;&gt;ensure contrast ratio&lt;/a&gt; and override some of the colors if background is too close to the foreground.&lt;/p&gt;
&lt;p&gt;To test your palette there are age-old scripts, &lt;a href=&#34;https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html&#34;&gt;e.g&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#!/bin/bash
#
#   This file echoes a bunch of color codes to the
#   terminal to demonstrate what&amp;#39;s available.  Each
#   line is the color code of one forground color,
#   out of 17 (default + 16 escapes), followed by a
#   test use of that color on all nine background
#   colors (default + 8 escapes).
#

T=&amp;#39;gYw&amp;#39;   # The test text

echo -e &amp;#34;\n                 40m     41m     42m     43m\
     44m     45m     46m     47m&amp;#34;;

for FGs in &amp;#39;    m&amp;#39; &amp;#39;   1m&amp;#39; &amp;#39;  30m&amp;#39; &amp;#39;1;30m&amp;#39; &amp;#39;  31m&amp;#39; &amp;#39;1;31m&amp;#39; &amp;#39;  32m&amp;#39; \
           &amp;#39;1;32m&amp;#39; &amp;#39;  33m&amp;#39; &amp;#39;1;33m&amp;#39; &amp;#39;  34m&amp;#39; &amp;#39;1;34m&amp;#39; &amp;#39;  35m&amp;#39; &amp;#39;1;35m&amp;#39; \
           &amp;#39;  36m&amp;#39; &amp;#39;1;36m&amp;#39; &amp;#39;  37m&amp;#39; &amp;#39;1;37m&amp;#39;;
  do FG=${FGs// /}
  echo -en &amp;#34; $FGs \033[$FG  $T  &amp;#34;
  for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
    do echo -en &amp;#34;$EINS \033[$FG\033[$BG  $T  \033[0m&amp;#34;;
  done
  echo;
done
echo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Which produces a pic like the following&lt;/p&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colors-colortest.png&#34; alt=&#34;Color test script output&#34; title=&#34;Color test script output&#34; /&gt;
&lt;p&gt;At this point you are supposed to change colors until you like the output. I am almost sure I took Tomorrow colors years ago and tweaked black and white to be &lt;code&gt;#000&lt;/code&gt; and &lt;code&gt;#fff&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; People go great lenghts not to use terminal colors &lt;a href=&#34;https://github.com/gurgeous/table_tennis/blob/main/lib/table_tennis/util/termbg.rb&#34;&gt;sometimes&lt;/a&gt;. It removes the assumption that your theme colors are well aligned, and it&amp;rsquo;s impressive that it works automatically. I don&amp;rsquo;t think you should fight terminal colors though, you probably figured already.&lt;/p&gt;
&lt;h2 id=&#34;neovim-supports-hex-colors-it-doesnt-mean-you-should-use-them&#34;&gt;Neovim supports hex colors, it doesn&amp;rsquo;t mean you should use them&lt;/h2&gt;
&lt;p&gt;Okay now, neovim. There is a concept of highlighting groups which accepts all the colors you want. Generally speaking, this makes sense. Neovim can be embedded or run in a GUI, and thus doesn&amp;rsquo;t have to have terminal colors available. But I never do any of that, for me neovim always runs in wezterm, and it&amp;rsquo;s only natural to set colors once instead of aligning palettes (more than once, there are plugins that need separate setup, I use fzf and lualine).&lt;/p&gt;
&lt;p&gt;More important is that things I want to highlight don&amp;rsquo;t match most of the other colorschemes. I am happy to only highlight comments, search, selection and some UI and have most of the things default foreground on default background. I made a colorscheme and &lt;a href=&#34;https://smagin.fyi/posts/colorscheme/&#34;&gt;wrote&lt;/a&gt; about it. Using terminal colors, I could promote this idiosyncrasy across different themes &amp;ndash; you could have your Catpuccin colors with Boring Tomorrow principles! You could switch between dark and light modes. You could try new themes without code highlighting being odd. You could make your own themes.&lt;/p&gt;
&lt;h3 id=&#34;technical-details&#34;&gt;Technical details&lt;/h3&gt;
&lt;p&gt;All the things neovim are better solved with reading the fucking manual. So,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;:help termguicolors
:help nvim_set_hl
:help highlight
:help colorscheme
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There isn&amp;rsquo;t much to describe, for my case it&amp;rsquo;s a pretty dull change from hex to term colors. For the record, here are things I stumbled upon:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To make neovim colorscheme use terminal colors, set &lt;code&gt;termguicolors = false&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;Bold + black (1) is displayed gray. I ended up using 255 for comments.&lt;/li&gt;
&lt;li&gt;For default background and foreground you can use &amp;ldquo;NONE&amp;rdquo;&lt;/li&gt;
&lt;li&gt;lualine supports both highlight groups and any colors for its themes. I used colors because the combinations aren&amp;rsquo;t used anywhere else.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The result lives in the &lt;a href=&#34;https://gist.github.com/s-mage/514bb4c41a06006ee40450ca8415c6c9&#34;&gt;same gist&lt;/a&gt; as before.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; and the colors for wezterm are &lt;a href=&#34;https://gist.github.com/s-mage/7e63ca5702d81708bef3b634def0d8f0&#34;&gt;in another gist&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://man7.org/linux/man-pages/man5/terminal-colors.d.5.html&#34;&gt;man terminal-colors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://jvns.ca/blog/2024/10/01/terminal-colours/&#34;&gt;bag of tricks for terminals from jvns&lt;/a&gt;. Problem 11 is the colors in vim. Julia solves it with using standard hex colors, we don&amp;rsquo;t want that.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://wezterm.org/config/lua/config/text_min_contrast_ratio.html&#34;&gt;wezterm can bend colors for contrast&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://wezterm.org/config/lua/color/contrast_ratio.html&#34;&gt;how to test for contrast&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://hamvocke.com/blog/lets-create-a-terminal-color-scheme/&#34;&gt;oklch for terminal colors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
      <content:encoded>&lt;p&gt;I have an nvim theme called Boring Tomorrow that highlights different things in and around the code than most of the themes. I have a &lt;a href=&#34;https://smagin.fyi/posts/colorscheme/&#34;&gt;post&lt;/a&gt; about it.&lt;/p&gt;
&lt;p&gt;I changed the theme recently to use terminal colors instead of colors set in neovim, splitting things I want to highlight from the the colors I like. Incidentally, this brings dark mode switch a problem of the terminal.&lt;/p&gt;
&lt;p&gt;TL;DR:&lt;/p&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colors-all.png&#34; alt=&#34;Different terminal colors with Boring Tomorrow highlight&#34; title=&#34;Different terminal colors with Boring Tomorrow highlight&#34; class=&#34;wide-image&#34; /&gt;
&lt;h2 id=&#34;terminals-support-hex-colors-it-doesnt-mean-i-should-use-them&#34;&gt;Terminals support hex colors, it doesn&amp;rsquo;t mean I should use them&lt;/h2&gt;
&lt;p&gt;In 2026, basically all terminals support all the same colors as browsers. It was an achievement when the standard was made and implemented. Before, it was just a limited set of colors and people just lived with them. I suggest we treat this limited set as a lucky state of the world where most of the apps will use colors from the same palette.&lt;/p&gt;
&lt;h3 id=&#34;digression-color-palettes-in-web&#34;&gt;Digression: Color palettes in web&lt;/h3&gt;
&lt;p&gt;&amp;hellip;do not exist globally. There are default styles and default color names, but you can&amp;rsquo;t bring your own palette and repaint the whole internet just for yourself. But, css is really flexible and vast, and people and companies definitely wanted to reuse styles for their different sites.&lt;/p&gt;
&lt;p&gt;I believe there is very little secret in how css works but in case you&amp;rsquo;re one of the &lt;a href=&#34;https://xkcd.com/1053/&#34;&gt;lucky 10 000&lt;/a&gt;, you can import a css on the website and it will be applied. Additionally, many people use standardised design tokens that include colors, fonts, and sizes. One abstraction layer on top of the tokens are components that are often specified with more than just css. If we only talk about color palettes, the most influential ones are from Bootstrap and Tailwind, but there are literally thousands out there. Julia Evans has &lt;a href=&#34;https://jvns.ca/blog/2026/05/04/css-colour-palettes/&#34;&gt;an opinionated collection&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;From the other side, people wanted to apply all sorts of patches for different sites just for themselves, and there is a word userstyles for the css part of that. Adblock is weirdly in the same group because annoying parts of the websites often deserve to be hidden rather than polished.&lt;/p&gt;
&lt;p&gt;So what I&amp;rsquo;m saying is, terminals are lucky to have a standard overridable set of colors. Web would be one dimension more flexible if it had a similar thing. There is one for fonts, if you set &lt;code&gt;font-family: serif&lt;/code&gt; browser will use the font from the browser settings. You can even force pages to use your fonts instead of whatever they do. It used to break icon fonts (wasn&amp;rsquo;t awesome of fontawesome) but icon fonts are out of fashion now and this option is not a joke anymore. To try in Firefox, uncheck &lt;code&gt;Fonts -&amp;gt; advanced -&amp;gt; Allow pages to choose their own fonts, instead of your selections above&lt;/code&gt;.&lt;/p&gt;
&lt;h3 id=&#34;16-colors-ought-to-be-enough&#34;&gt;16 colors ought to be enough&lt;/h3&gt;
&lt;p&gt;Terminals emulators are old. Important consequences of it are that they are severely backward-compatible, and that there are many CLI apps that want to be run on anything and use backward-compatible colors.&lt;/p&gt;
&lt;p&gt;For the purpose of having a global overridable color palette, there are 256 colors that are supported everywhere, and they are one way or another derived from 16: black, red, green, yellow, blue, magenta, cyan, white, and &amp;ldquo;bright&amp;rdquo; versions of them. So, you could say there are only eight basic colors but in practice you want to define 16 as foregrounds and backgrounds.&lt;/p&gt;
&lt;p&gt;To expand the palette to 256 colors you could use all the tricks you want. Traditional definition is an rgb cube:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;# quoting the wikipedia page above
  0-  7:  standard colors (as in ESC [ 30–37 m)
  8- 15:  high intensity colors (as in ESC [ 90–97 m)
 16-231:  6 × 6 × 6 cube (216 colors): 16 + 36 × r + 6 × g + b (0 ≤ r, g, b ≤ 5)
232-255:  grayscale from dark to light in 24 steps
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Web devs got nicer ways to generate palettes. There is a huge topic of color spaces, the current state of the art is oklch. We won&amp;rsquo;t dig into there, the only color we use from the extended palette is 255 for black, because black(0)+bold is drawn as gray according to some (same?) ancient protocol.&lt;/p&gt;
&lt;h3 id=&#34;making-a-terminal-colorscheme&#34;&gt;Making a terminal colorscheme&lt;/h3&gt;
&lt;p&gt;Aside of the colors already mentioned, there are more:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;background and foreground&lt;/li&gt;
&lt;li&gt;cursor background and foreground&lt;/li&gt;
&lt;li&gt;selection background and foreground&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;They belong to the colorscheme but are not accessible from the apps. There is an obvious reason for that, but it adds the assumption that all these colors match the rest of the palette. It&amp;rsquo;s not always the case, and e.g. wezterm even has an option to &lt;a href=&#34;https://wezterm.org/config/lua/config/text_min_contrast_ratio.html&#34;&gt;ensure contrast ratio&lt;/a&gt; and override some of the colors if background is too close to the foreground.&lt;/p&gt;
&lt;p&gt;To test your palette there are age-old scripts, &lt;a href=&#34;https://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html&#34;&gt;e.g&lt;/a&gt;&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#!/bin/bash
#
#   This file echoes a bunch of color codes to the
#   terminal to demonstrate what&amp;#39;s available.  Each
#   line is the color code of one forground color,
#   out of 17 (default + 16 escapes), followed by a
#   test use of that color on all nine background
#   colors (default + 8 escapes).
#

T=&amp;#39;gYw&amp;#39;   # The test text

echo -e &amp;#34;\n                 40m     41m     42m     43m\
     44m     45m     46m     47m&amp;#34;;

for FGs in &amp;#39;    m&amp;#39; &amp;#39;   1m&amp;#39; &amp;#39;  30m&amp;#39; &amp;#39;1;30m&amp;#39; &amp;#39;  31m&amp;#39; &amp;#39;1;31m&amp;#39; &amp;#39;  32m&amp;#39; \
           &amp;#39;1;32m&amp;#39; &amp;#39;  33m&amp;#39; &amp;#39;1;33m&amp;#39; &amp;#39;  34m&amp;#39; &amp;#39;1;34m&amp;#39; &amp;#39;  35m&amp;#39; &amp;#39;1;35m&amp;#39; \
           &amp;#39;  36m&amp;#39; &amp;#39;1;36m&amp;#39; &amp;#39;  37m&amp;#39; &amp;#39;1;37m&amp;#39;;
  do FG=${FGs// /}
  echo -en &amp;#34; $FGs \033[$FG  $T  &amp;#34;
  for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
    do echo -en &amp;#34;$EINS \033[$FG\033[$BG  $T  \033[0m&amp;#34;;
  done
  echo;
done
echo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Which produces a pic like the following&lt;/p&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colors-colortest.png&#34; alt=&#34;Color test script output&#34; title=&#34;Color test script output&#34; /&gt;
&lt;p&gt;At this point you are supposed to change colors until you like the output. I am almost sure I took Tomorrow colors years ago and tweaked black and white to be &lt;code&gt;#000&lt;/code&gt; and &lt;code&gt;#fff&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; People go great lenghts not to use terminal colors &lt;a href=&#34;https://github.com/gurgeous/table_tennis/blob/main/lib/table_tennis/util/termbg.rb&#34;&gt;sometimes&lt;/a&gt;. It removes the assumption that your theme colors are well aligned, and it&amp;rsquo;s impressive that it works automatically. I don&amp;rsquo;t think you should fight terminal colors though, you probably figured already.&lt;/p&gt;
&lt;h2 id=&#34;neovim-supports-hex-colors-it-doesnt-mean-you-should-use-them&#34;&gt;Neovim supports hex colors, it doesn&amp;rsquo;t mean you should use them&lt;/h2&gt;
&lt;p&gt;Okay now, neovim. There is a concept of highlighting groups which accepts all the colors you want. Generally speaking, this makes sense. Neovim can be embedded or run in a GUI, and thus doesn&amp;rsquo;t have to have terminal colors available. But I never do any of that, for me neovim always runs in wezterm, and it&amp;rsquo;s only natural to set colors once instead of aligning palettes (more than once, there are plugins that need separate setup, I use fzf and lualine).&lt;/p&gt;
&lt;p&gt;More important is that things I want to highlight don&amp;rsquo;t match most of the other colorschemes. I am happy to only highlight comments, search, selection and some UI and have most of the things default foreground on default background. I made a colorscheme and &lt;a href=&#34;https://smagin.fyi/posts/colorscheme/&#34;&gt;wrote&lt;/a&gt; about it. Using terminal colors, I could promote this idiosyncrasy across different themes &amp;ndash; you could have your Catpuccin colors with Boring Tomorrow principles! You could switch between dark and light modes. You could try new themes without code highlighting being odd. You could make your own themes.&lt;/p&gt;
&lt;h3 id=&#34;technical-details&#34;&gt;Technical details&lt;/h3&gt;
&lt;p&gt;All the things neovim are better solved with reading the fucking manual. So,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;:help termguicolors
:help nvim_set_hl
:help highlight
:help colorscheme
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;There isn&amp;rsquo;t much to describe, for my case it&amp;rsquo;s a pretty dull change from hex to term colors. For the record, here are things I stumbled upon:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To make neovim colorscheme use terminal colors, set &lt;code&gt;termguicolors = false&lt;/code&gt;;&lt;/li&gt;
&lt;li&gt;Bold + black (1) is displayed gray. I ended up using 255 for comments.&lt;/li&gt;
&lt;li&gt;For default background and foreground you can use &amp;ldquo;NONE&amp;rdquo;&lt;/li&gt;
&lt;li&gt;lualine supports both highlight groups and any colors for its themes. I used colors because the combinations aren&amp;rsquo;t used anywhere else.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The result lives in the &lt;a href=&#34;https://gist.github.com/s-mage/514bb4c41a06006ee40450ca8415c6c9&#34;&gt;same gist&lt;/a&gt; as before.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; and the colors for wezterm are &lt;a href=&#34;https://gist.github.com/s-mage/7e63ca5702d81708bef3b634def0d8f0&#34;&gt;in another gist&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://man7.org/linux/man-pages/man5/terminal-colors.d.5.html&#34;&gt;man terminal-colors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://jvns.ca/blog/2024/10/01/terminal-colours/&#34;&gt;bag of tricks for terminals from jvns&lt;/a&gt;. Problem 11 is the colors in vim. Julia solves it with using standard hex colors, we don&amp;rsquo;t want that.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://wezterm.org/config/lua/config/text_min_contrast_ratio.html&#34;&gt;wezterm can bend colors for contrast&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://wezterm.org/config/lua/color/contrast_ratio.html&#34;&gt;how to test for contrast&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://hamvocke.com/blog/lets-create-a-terminal-color-scheme/&#34;&gt;oklch for terminal colors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
    </item>
    <item>
      <title>Software on Its Users Side</title>
      <link>https://smagin.fyi/posts/software-on-its-users-side/</link>
      <pubDate>Sat, 10 Jan 2026 10:00:00 +0100</pubDate>
      <guid>https://smagin.fyi/posts/software-on-its-users-side/</guid>
      <description>&lt;p&gt;When I try to pitch my budget app people always say that they have some kind of analytics in their bank app. I then tell that banks and their apps are not on the side of the clients. This article is to explain what I mean by that.&lt;/p&gt;
&lt;h2 id=&#34;your-bank-and-you-have-different-goals&#34;&gt;Your bank and you have different goals&lt;/h2&gt;
&lt;p&gt;Here is how I imagine a normal person relations with money: you are in charge of your budget, so you need to be in control of it. You also don&amp;rsquo;t want to stress about it now or later.
To achieve this, you should control lifestyle creep, have a contingency fund and a plan of what you&amp;rsquo;d do when you stop working. If you&amp;rsquo;re in a bad financial situation, you need to know why and see how to mitigate it. And so on and so forth.&lt;/p&gt;
&lt;p&gt;Banks run businesses. They have multiple products, for people and companies, for different life situations, and they have competitors. Enter your favourite meme about shareholder value if you like, but making you happy won&amp;rsquo;t be their north star, they simply have more things to look at. Additionally, your current and savings accounts are not very profitable compared to other things they do. I feel like this should be considered a marketing effort, because that&amp;rsquo;s how they advertise you their other products.&lt;/p&gt;
&lt;p&gt;As a result, you probably have a bank app for every bank that has information about your accounts and your transactions. This information has little to help you with your financial decisions.&lt;/p&gt;
&lt;p&gt;This is why products that focus on a personal and/or family budget exist.&lt;/p&gt;
&lt;h2 id=&#34;signs-that-an-app-is-on-your-side&#34;&gt;Signs that an app is on your side&lt;/h2&gt;
&lt;p&gt;You probably heard that if you don&amp;rsquo;t pay for a product you are the product. That&amp;rsquo;s a simplification.&lt;/p&gt;
&lt;p&gt;A positive exception from this rule is that there is ideologically free open source software that people make for dozens of years, think VLC. They have no plans to make a business of it. They don&amp;rsquo;t owe you anything either but presumably if someone is working on a thing for years for free they would make it good for themselves and if you are a bit like them you might like their app.&lt;/p&gt;
&lt;p&gt;A negative exception would be that you pay for a product, and you&amp;rsquo;re still a product. The banking apps are one, but big companies that have many products are all the same in this regard &amp;ndash; they would pitch you their other products through ones you already use.&lt;/p&gt;
&lt;p&gt;Another thing that happened to me repeatedly and that I look very carefully at are companies that took investments. Such companies would need to return those investments or close, and this would become their goal. They would do all the things unrelated to why you started using them in the first place, and raise prices in process.&lt;/p&gt;
&lt;p&gt;If it&amp;rsquo;s not a big company and not a startup in debt, the main sign that an app is on your side would be that you pay by a scheme that makes sense. If the app has to run a server or has support or whatever other opex, you likely need to pay a subscription for it to sustain. A local app that you download once can be paid once with the only risk that it will stop working after you OS update. Sometimes there are lifetime plans for otherwise subscription services &amp;ndash; that&amp;rsquo;s maybe fine but lifetime should be perceived as the service lifetime, not yours.&lt;/p&gt;
&lt;p&gt;Money aside, the app should declare it does the thing you want it to do. It may sound obvious but saying &amp;ldquo;I will manage my budget with my bank app&amp;rdquo; rather than &amp;ldquo;I will manage my budget with a budget app&amp;rdquo; is an example of that and people have those thoughts all the time.&lt;/p&gt;
&lt;h2 id=&#34;things-unrelated-to-any-user-goals&#34;&gt;Things unrelated to any user goals&lt;/h2&gt;
&lt;p&gt;Here is a list of first things came to mind that annoy me that apps have for reasons clearly other than users needs.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Logout after some couple weeks of inactivity. Considered a security practice, I couldn&amp;rsquo;t find how exactly it&amp;rsquo;s secure.&lt;/li&gt;
&lt;li&gt;Cookie banners. No it&amp;rsquo;s not because EU is bad, it&amp;rsquo;s because you want analytics on your landing pages.&lt;/li&gt;
&lt;li&gt;Intercom with a &amp;ldquo;how can I help you&amp;rdquo; popup. I&amp;rsquo;ll ask for help if I&amp;rsquo;m stuck, thank you. Has to be another marketing gimmick.&lt;/li&gt;
&lt;li&gt;✨ask ai. The worse version of the previous one.&lt;/li&gt;
&lt;li&gt;New feature announcements. I kind of get it, and it might be a good feature, but I can&amp;rsquo;t make myself read them because I didn’t open the app to read changelogs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sometimes those things appear because everyone does them. Kant and his principle of universalizability helps if you apply it in a certain way (oh the irony). So you have a feature in your app, or want to add it. Now, if you remove it from all the software, will it make the world better? If so, you probably shouldn&amp;rsquo;t have it.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://mastodon.online/@smagin/115870067789777300&#34;&gt;Discuss on mastodon&lt;/a&gt; &lt;a href=&#34;https://x.com/s_mage/status/2009918540619649244&#34;&gt;or twitter&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;sources&#34;&gt;Sources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tonsky.me/blog/needy-programs/&#34;&gt;Needy Programs&lt;/a&gt; &amp;ndash; logins and credit card issues and software updates annoy tonsky,&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://brave.com/privacy-updates/36-adblock-memory-reduction/&#34;&gt;Brave improved their adblock&lt;/a&gt; &amp;ndash; browsers have extentions, but chrome nerfed adblock via manifest v3 which sparkled some innovation it seems,&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Categorical_imperative&#34;&gt;Categorical Imperative&lt;/a&gt; &amp;ndash; do as your actions were a universal law.&lt;/li&gt;
&lt;/ul&gt;
</description>
      <content:encoded>&lt;p&gt;When I try to pitch my budget app people always say that they have some kind of analytics in their bank app. I then tell that banks and their apps are not on the side of the clients. This article is to explain what I mean by that.&lt;/p&gt;
&lt;h2 id=&#34;your-bank-and-you-have-different-goals&#34;&gt;Your bank and you have different goals&lt;/h2&gt;
&lt;p&gt;Here is how I imagine a normal person relations with money: you are in charge of your budget, so you need to be in control of it. You also don&amp;rsquo;t want to stress about it now or later.
To achieve this, you should control lifestyle creep, have a contingency fund and a plan of what you&amp;rsquo;d do when you stop working. If you&amp;rsquo;re in a bad financial situation, you need to know why and see how to mitigate it. And so on and so forth.&lt;/p&gt;
&lt;p&gt;Banks run businesses. They have multiple products, for people and companies, for different life situations, and they have competitors. Enter your favourite meme about shareholder value if you like, but making you happy won&amp;rsquo;t be their north star, they simply have more things to look at. Additionally, your current and savings accounts are not very profitable compared to other things they do. I feel like this should be considered a marketing effort, because that&amp;rsquo;s how they advertise you their other products.&lt;/p&gt;
&lt;p&gt;As a result, you probably have a bank app for every bank that has information about your accounts and your transactions. This information has little to help you with your financial decisions.&lt;/p&gt;
&lt;p&gt;This is why products that focus on a personal and/or family budget exist.&lt;/p&gt;
&lt;h2 id=&#34;signs-that-an-app-is-on-your-side&#34;&gt;Signs that an app is on your side&lt;/h2&gt;
&lt;p&gt;You probably heard that if you don&amp;rsquo;t pay for a product you are the product. That&amp;rsquo;s a simplification.&lt;/p&gt;
&lt;p&gt;A positive exception from this rule is that there is ideologically free open source software that people make for dozens of years, think VLC. They have no plans to make a business of it. They don&amp;rsquo;t owe you anything either but presumably if someone is working on a thing for years for free they would make it good for themselves and if you are a bit like them you might like their app.&lt;/p&gt;
&lt;p&gt;A negative exception would be that you pay for a product, and you&amp;rsquo;re still a product. The banking apps are one, but big companies that have many products are all the same in this regard &amp;ndash; they would pitch you their other products through ones you already use.&lt;/p&gt;
&lt;p&gt;Another thing that happened to me repeatedly and that I look very carefully at are companies that took investments. Such companies would need to return those investments or close, and this would become their goal. They would do all the things unrelated to why you started using them in the first place, and raise prices in process.&lt;/p&gt;
&lt;p&gt;If it&amp;rsquo;s not a big company and not a startup in debt, the main sign that an app is on your side would be that you pay by a scheme that makes sense. If the app has to run a server or has support or whatever other opex, you likely need to pay a subscription for it to sustain. A local app that you download once can be paid once with the only risk that it will stop working after you OS update. Sometimes there are lifetime plans for otherwise subscription services &amp;ndash; that&amp;rsquo;s maybe fine but lifetime should be perceived as the service lifetime, not yours.&lt;/p&gt;
&lt;p&gt;Money aside, the app should declare it does the thing you want it to do. It may sound obvious but saying &amp;ldquo;I will manage my budget with my bank app&amp;rdquo; rather than &amp;ldquo;I will manage my budget with a budget app&amp;rdquo; is an example of that and people have those thoughts all the time.&lt;/p&gt;
&lt;h2 id=&#34;things-unrelated-to-any-user-goals&#34;&gt;Things unrelated to any user goals&lt;/h2&gt;
&lt;p&gt;Here is a list of first things came to mind that annoy me that apps have for reasons clearly other than users needs.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Logout after some couple weeks of inactivity. Considered a security practice, I couldn&amp;rsquo;t find how exactly it&amp;rsquo;s secure.&lt;/li&gt;
&lt;li&gt;Cookie banners. No it&amp;rsquo;s not because EU is bad, it&amp;rsquo;s because you want analytics on your landing pages.&lt;/li&gt;
&lt;li&gt;Intercom with a &amp;ldquo;how can I help you&amp;rdquo; popup. I&amp;rsquo;ll ask for help if I&amp;rsquo;m stuck, thank you. Has to be another marketing gimmick.&lt;/li&gt;
&lt;li&gt;✨ask ai. The worse version of the previous one.&lt;/li&gt;
&lt;li&gt;New feature announcements. I kind of get it, and it might be a good feature, but I can&amp;rsquo;t make myself read them because I didn’t open the app to read changelogs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sometimes those things appear because everyone does them. Kant and his principle of universalizability helps if you apply it in a certain way (oh the irony). So you have a feature in your app, or want to add it. Now, if you remove it from all the software, will it make the world better? If so, you probably shouldn&amp;rsquo;t have it.&lt;/p&gt;
&lt;p&gt;Thanks for reading.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://mastodon.online/@smagin/115870067789777300&#34;&gt;Discuss on mastodon&lt;/a&gt; &lt;a href=&#34;https://x.com/s_mage/status/2009918540619649244&#34;&gt;or twitter&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;sources&#34;&gt;Sources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://tonsky.me/blog/needy-programs/&#34;&gt;Needy Programs&lt;/a&gt; &amp;ndash; logins and credit card issues and software updates annoy tonsky,&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://brave.com/privacy-updates/36-adblock-memory-reduction/&#34;&gt;Brave improved their adblock&lt;/a&gt; &amp;ndash; browsers have extentions, but chrome nerfed adblock via manifest v3 which sparkled some innovation it seems,&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Categorical_imperative&#34;&gt;Categorical Imperative&lt;/a&gt; &amp;ndash; do as your actions were a universal law.&lt;/li&gt;
&lt;/ul&gt;
</content:encoded>
    </item>
    <item>
      <title>Spacing Over Cards</title>
      <link>https://smagin.fyi/posts/padding-over-cards/</link>
      <pubDate>Sun, 31 Aug 2025 09:48:20 +0200</pubDate>
      <guid>https://smagin.fyi/posts/padding-over-cards/</guid>
      <description>&lt;p&gt;This post is a rationalisation of &amp;ldquo;I don&amp;rsquo;t like cards&amp;rdquo;. I say that in most cases where cards are used, they don&amp;rsquo;t need to be used. Specifically, they take space, they let you skip gestalt principles and be lazy and undisciplined, and being so easy to implement they are often used by developers. To multiply the effect, you can put a card into a card, and it seems so hard not to do so.&lt;/p&gt;
&lt;p&gt;We recognise patterns. This is known for quite some time, specifically Wertheimer in 1923 wrote the paper that everyone cites, where he said just that, and additionally suggested a number of laws of how patterns are recognised. The paper is called &lt;a href=&#34;https://psychclassics.yorku.ca/Wertheimer/Forms/forms.htm&#34;&gt;Laws of Organization in Perceptual Forms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Dejan Todorović wrote an article named &lt;a href=&#34;http://www.scholarpedia.org/article/Gestalt_principles&#34;&gt;Gestalt Principles&lt;/a&gt; where he retold this work and added more principles that were proposed later.&lt;/p&gt;
&lt;p&gt;Principles that we&amp;rsquo;ll use here are the proximity principle and the principle of common region.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Cards got overused. Often you can achieve better results by applying the proximity principle instead. The principle is, recursively, objects that are closer to each other than to other objects are perceived as a whole.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;grug version:&lt;/strong&gt; grug read gestalt principles. grug make internal spacing less than external spacing, applies proximity principle. proximity enough, no need for cards.&lt;/p&gt;
&lt;h2 id=&#34;spacing-proximity-principle&#34;&gt;Spacing: Proximity Principle&lt;/h2&gt;
&lt;p&gt;Traditionally, proximity principle is put the following way: elements tend to be perceived as aggregated into groups if they are near each other. Usually this comes with the term Negative Space, which is basically gap between content.&lt;/p&gt;
&lt;p&gt;I find the following phrasing more helpful: &lt;em&gt;Recursively, internal spacing should be no larger than external spacing.&lt;/em&gt; Example:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Proximity principle demo&#34; src=&#34; /pics/cards-proximity-demo.svg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; in CSS there are at least &lt;code&gt;gap&lt;/code&gt;, &lt;code&gt;margin&lt;/code&gt; and &lt;code&gt;padding&lt;/code&gt; properties to set spacing. Please don&amp;rsquo;t emulate one with another without a good reason. There is a more radical take on it that says &lt;a href=&#34;https://mxstbr.com/thoughts/margin&#34;&gt;margin considered harmful&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;cards-common-region-principle&#34;&gt;Cards: Common Region Principle&lt;/h2&gt;
&lt;p&gt;The definition goes like: &lt;em&gt;elements tend to be grouped together if they are located within the same closed region.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Basically, in our brains cards have preference over spacing. Example:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Common region principle demo&#34; src=&#34; /pics/cards-common-region-demo.svg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s too convenient. I mean yes, you can make everything of cards, but there are other principles, and there is a &lt;em&gt;cards tax&lt;/em&gt; in space and cognitive burden. So.&lt;/p&gt;
&lt;h2 id=&#34;whats-wrong-with-cards&#34;&gt;What&amp;rsquo;s wrong with cards&lt;/h2&gt;
&lt;h3 id=&#34;cards-take-space&#34;&gt;Cards take space&lt;/h3&gt;
&lt;p&gt;Each card needs padding, there should still be a gap between cards. You can ignore it but sometimes it&amp;rsquo;s the difference between scroll and no scroll. Example:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-devtool-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-devtool-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Not only the scroll disappeared, but icons became way more visible and distinguishable from each other.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; I&amp;rsquo;ll send this as a suggestion to the &lt;a href=&#34;https://dev-tool.dev/&#34;&gt;dev-tool.dev&lt;/a&gt; developer.&lt;/p&gt;
&lt;h3 id=&#34;cards-conceal-that-you-dont-have-anything-to-say&#34;&gt;Cards conceal that you don&amp;rsquo;t have anything to say&lt;/h3&gt;
&lt;p&gt;Imagine you&amp;rsquo;re making a landing page, or a changelog. You don&amp;rsquo;t have too many impressive things, so you sometimes rephrase something and put it the second time. Sometimes you can put unrelated items there. But if you do just that as a plain list, people would notice it easily, so you make each item a card. Additionally, you add bells and whistles and tags and ai-generated images. Here:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-logseq-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-logseq-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;How plugins and themes relate to being a safe space for thoughts? I get it, those are important, just not under this heading. How is logseq sync better than icloud? Why does the picture say &amp;ldquo;syncing&amp;rdquo; but description says always up-to-date?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all less noticeable when put into cards, but the healthier approach is to remove all the distraction, make a good skeleton, and expand that. Here is how &lt;a href=&#34;https://bookov.app/&#34;&gt;bookov.app&lt;/a&gt; goes with being free and storing stuff on device:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Bookov demo&#34; src=&#34; /pics/cards-bookov.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;It took quite amount of space, but it&amp;rsquo;s taken with text that is interesting to read, not with cards and empty words.&lt;/p&gt;
&lt;h3 id=&#34;cards-let-you-ignore-the-proximity-principle&#34;&gt;Cards let you ignore the proximity principle&lt;/h3&gt;
&lt;p&gt;Being the jocker of patterns, cards let you ignore the proximity principle inside them. I&amp;rsquo;ll put another screenshot but you can notice that on any of the screenshots above as well.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-firefox-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-firefox-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Space between tags and heading and heading and text is the same, and the same as space between cards. Subheading &amp;ldquo;new tools for focus&amp;hellip;&amp;rdquo; is closer to the cards than to the heading. Inside the tag, space between icon and text is bigger than space between tags, and than tag padding.&lt;/p&gt;
&lt;p&gt;If we put the spacing in order, it becomes obvious that tags are the most noticeable elements there, and that they don&amp;rsquo;t deserve it because they carry zero new information.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-firefox-after-2.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h3 id=&#34;cards-add-cognitive-burden&#34;&gt;Cards add cognitive burden&lt;/h3&gt;
&lt;p&gt;Cards enclose elements. This makes new elements, the cards themselves, and they make new relations between elements. Designers and developers need to pay more attention to compose them, and people who see the result need to perceive them all. Metaphorically, I need to dive into a card to see what&amp;rsquo;s inside. When we are in a grid of cards, I need to dive in and out instead of glancing through the grid. Look:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-lawsofux-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-lawsofux-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;When we remove all the extra relations, skimming through headlines becomes easier even though they became smaller. It also allowed to scale the pictures. Some of them could be re-drawn for the format but there is no good reason to put them on cards without making them full width. And when we done that, it becomes apparent that some of the pictures are not really helpful in understanding the matter.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; There is an idea of data-inc ratio, that is mainly applied to graphs, but IMO would perfectly fit here as well. The reason you shouldn&amp;rsquo;t waste even metaphorical inc is that brain has to perceive it. &lt;a href=&#34;https://jtr13.github.io/cc19/tuftes-principles-of-data-ink.html&#34;&gt;Bag of tricks with charts&lt;/a&gt; if you&amp;rsquo;re interested.&lt;/p&gt;
&lt;h2 id=&#34;where-cards-are-appropriate&#34;&gt;Where cards are appropriate&lt;/h2&gt;
&lt;p&gt;All that said, cards are a useful trick. The usefulness comes from the same traits that makes them unneeded in the cases above: they enclose elements, make them stand out, and require people to dive inside them.&lt;/p&gt;
&lt;p&gt;Classic example is CTA. You already said what you had, and now need to summarise it and give people one clear direction from your page. Mine is as good as any:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;CTA&#34; src=&#34; /pics/cards-within-means-cta.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Another example could be when internal layout of the card is substantially complex and it&amp;rsquo;s hard to make the distinction using only spacing. Or when what&amp;rsquo;s inside the card could be a page itself, like a product card where you can choose between variations and add to cart.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Complex card&#34; src=&#34; /pics/cards-tasty-coffee.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;For so many situations where cards are used, padding would be enough. Putting spacing into an order requires attention, but that&amp;rsquo;s a good one, where semi-automatic application of the proximity principle leads to better result every time.&lt;/p&gt;
&lt;p&gt;The principle: &lt;em&gt;Recursively, internal spacing should be no larger than external spacing.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://mastodon.online/@smagin/115123706644580981&#34;&gt;This post on Mastodon&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;http://www.scholarpedia.org/article/Gestalt_principles&#34;&gt;Gestalt Principles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.chrbutler.com/gestalt-principles-of-design-proximity&#34;&gt;One of the better articles on proximity by Christopher Butler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://jtr13.github.io/cc19/tuftes-principles-of-data-ink.html&#34;&gt;Data-Inc ratio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://mxstbr.com/thoughts/margin&#34;&gt;Margin considered harmful&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</description>
      <content:encoded>&lt;p&gt;This post is a rationalisation of &amp;ldquo;I don&amp;rsquo;t like cards&amp;rdquo;. I say that in most cases where cards are used, they don&amp;rsquo;t need to be used. Specifically, they take space, they let you skip gestalt principles and be lazy and undisciplined, and being so easy to implement they are often used by developers. To multiply the effect, you can put a card into a card, and it seems so hard not to do so.&lt;/p&gt;
&lt;p&gt;We recognise patterns. This is known for quite some time, specifically Wertheimer in 1923 wrote the paper that everyone cites, where he said just that, and additionally suggested a number of laws of how patterns are recognised. The paper is called &lt;a href=&#34;https://psychclassics.yorku.ca/Wertheimer/Forms/forms.htm&#34;&gt;Laws of Organization in Perceptual Forms&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Dejan Todorović wrote an article named &lt;a href=&#34;http://www.scholarpedia.org/article/Gestalt_principles&#34;&gt;Gestalt Principles&lt;/a&gt; where he retold this work and added more principles that were proposed later.&lt;/p&gt;
&lt;p&gt;Principles that we&amp;rsquo;ll use here are the proximity principle and the principle of common region.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Cards got overused. Often you can achieve better results by applying the proximity principle instead. The principle is, recursively, objects that are closer to each other than to other objects are perceived as a whole.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;grug version:&lt;/strong&gt; grug read gestalt principles. grug make internal spacing less than external spacing, applies proximity principle. proximity enough, no need for cards.&lt;/p&gt;
&lt;h2 id=&#34;spacing-proximity-principle&#34;&gt;Spacing: Proximity Principle&lt;/h2&gt;
&lt;p&gt;Traditionally, proximity principle is put the following way: elements tend to be perceived as aggregated into groups if they are near each other. Usually this comes with the term Negative Space, which is basically gap between content.&lt;/p&gt;
&lt;p&gt;I find the following phrasing more helpful: &lt;em&gt;Recursively, internal spacing should be no larger than external spacing.&lt;/em&gt; Example:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Proximity principle demo&#34; src=&#34; /pics/cards-proximity-demo.svg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; in CSS there are at least &lt;code&gt;gap&lt;/code&gt;, &lt;code&gt;margin&lt;/code&gt; and &lt;code&gt;padding&lt;/code&gt; properties to set spacing. Please don&amp;rsquo;t emulate one with another without a good reason. There is a more radical take on it that says &lt;a href=&#34;https://mxstbr.com/thoughts/margin&#34;&gt;margin considered harmful&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;cards-common-region-principle&#34;&gt;Cards: Common Region Principle&lt;/h2&gt;
&lt;p&gt;The definition goes like: &lt;em&gt;elements tend to be grouped together if they are located within the same closed region.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Basically, in our brains cards have preference over spacing. Example:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Common region principle demo&#34; src=&#34; /pics/cards-common-region-demo.svg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s too convenient. I mean yes, you can make everything of cards, but there are other principles, and there is a &lt;em&gt;cards tax&lt;/em&gt; in space and cognitive burden. So.&lt;/p&gt;
&lt;h2 id=&#34;whats-wrong-with-cards&#34;&gt;What&amp;rsquo;s wrong with cards&lt;/h2&gt;
&lt;h3 id=&#34;cards-take-space&#34;&gt;Cards take space&lt;/h3&gt;
&lt;p&gt;Each card needs padding, there should still be a gap between cards. You can ignore it but sometimes it&amp;rsquo;s the difference between scroll and no scroll. Example:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-devtool-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-devtool-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Not only the scroll disappeared, but icons became way more visible and distinguishable from each other.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; I&amp;rsquo;ll send this as a suggestion to the &lt;a href=&#34;https://dev-tool.dev/&#34;&gt;dev-tool.dev&lt;/a&gt; developer.&lt;/p&gt;
&lt;h3 id=&#34;cards-conceal-that-you-dont-have-anything-to-say&#34;&gt;Cards conceal that you don&amp;rsquo;t have anything to say&lt;/h3&gt;
&lt;p&gt;Imagine you&amp;rsquo;re making a landing page, or a changelog. You don&amp;rsquo;t have too many impressive things, so you sometimes rephrase something and put it the second time. Sometimes you can put unrelated items there. But if you do just that as a plain list, people would notice it easily, so you make each item a card. Additionally, you add bells and whistles and tags and ai-generated images. Here:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-logseq-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-logseq-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;How plugins and themes relate to being a safe space for thoughts? I get it, those are important, just not under this heading. How is logseq sync better than icloud? Why does the picture say &amp;ldquo;syncing&amp;rdquo; but description says always up-to-date?&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all less noticeable when put into cards, but the healthier approach is to remove all the distraction, make a good skeleton, and expand that. Here is how &lt;a href=&#34;https://bookov.app/&#34;&gt;bookov.app&lt;/a&gt; goes with being free and storing stuff on device:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Bookov demo&#34; src=&#34; /pics/cards-bookov.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;It took quite amount of space, but it&amp;rsquo;s taken with text that is interesting to read, not with cards and empty words.&lt;/p&gt;
&lt;h3 id=&#34;cards-let-you-ignore-the-proximity-principle&#34;&gt;Cards let you ignore the proximity principle&lt;/h3&gt;
&lt;p&gt;Being the jocker of patterns, cards let you ignore the proximity principle inside them. I&amp;rsquo;ll put another screenshot but you can notice that on any of the screenshots above as well.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-firefox-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-firefox-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Space between tags and heading and heading and text is the same, and the same as space between cards. Subheading &amp;ldquo;new tools for focus&amp;hellip;&amp;rdquo; is closer to the cards than to the heading. Inside the tag, space between icon and text is bigger than space between tags, and than tag padding.&lt;/p&gt;
&lt;p&gt;If we put the spacing in order, it becomes obvious that tags are the most noticeable elements there, and that they don&amp;rsquo;t deserve it because they carry zero new information.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-firefox-after-2.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h3 id=&#34;cards-add-cognitive-burden&#34;&gt;Cards add cognitive burden&lt;/h3&gt;
&lt;p&gt;Cards enclose elements. This makes new elements, the cards themselves, and they make new relations between elements. Designers and developers need to pay more attention to compose them, and people who see the result need to perceive them all. Metaphorically, I need to dive into a card to see what&amp;rsquo;s inside. When we are in a grid of cards, I need to dive in and out instead of glancing through the grid. Look:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Before&#34; src=&#34; /pics/cards-lawsofux-before.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;After&#34; src=&#34; /pics/cards-lawsofux-after.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;When we remove all the extra relations, skimming through headlines becomes easier even though they became smaller. It also allowed to scale the pictures. Some of them could be re-drawn for the format but there is no good reason to put them on cards without making them full width. And when we done that, it becomes apparent that some of the pictures are not really helpful in understanding the matter.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; There is an idea of data-inc ratio, that is mainly applied to graphs, but IMO would perfectly fit here as well. The reason you shouldn&amp;rsquo;t waste even metaphorical inc is that brain has to perceive it. &lt;a href=&#34;https://jtr13.github.io/cc19/tuftes-principles-of-data-ink.html&#34;&gt;Bag of tricks with charts&lt;/a&gt; if you&amp;rsquo;re interested.&lt;/p&gt;
&lt;h2 id=&#34;where-cards-are-appropriate&#34;&gt;Where cards are appropriate&lt;/h2&gt;
&lt;p&gt;All that said, cards are a useful trick. The usefulness comes from the same traits that makes them unneeded in the cases above: they enclose elements, make them stand out, and require people to dive inside them.&lt;/p&gt;
&lt;p&gt;Classic example is CTA. You already said what you had, and now need to summarise it and give people one clear direction from your page. Mine is as good as any:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;CTA&#34; src=&#34; /pics/cards-within-means-cta.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Another example could be when internal layout of the card is substantially complex and it&amp;rsquo;s hard to make the distinction using only spacing. Or when what&amp;rsquo;s inside the card could be a page itself, like a product card where you can choose between variations and add to cart.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Complex card&#34; src=&#34; /pics/cards-tasty-coffee.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;For so many situations where cards are used, padding would be enough. Putting spacing into an order requires attention, but that&amp;rsquo;s a good one, where semi-automatic application of the proximity principle leads to better result every time.&lt;/p&gt;
&lt;p&gt;The principle: &lt;em&gt;Recursively, internal spacing should be no larger than external spacing.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://mastodon.online/@smagin/115123706644580981&#34;&gt;This post on Mastodon&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;http://www.scholarpedia.org/article/Gestalt_principles&#34;&gt;Gestalt Principles&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.chrbutler.com/gestalt-principles-of-design-proximity&#34;&gt;One of the better articles on proximity by Christopher Butler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://jtr13.github.io/cc19/tuftes-principles-of-data-ink.html&#34;&gt;Data-Inc ratio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://mxstbr.com/thoughts/margin&#34;&gt;Margin considered harmful&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</content:encoded>
    </item>
    <item>
      <title>AI for Personal Finance?</title>
      <link>https://smagin.fyi/posts/ai-for-personal-finance/</link>
      <pubDate>Sun, 08 Jun 2025 08:56:53 +0200</pubDate>
      <guid>https://smagin.fyi/posts/ai-for-personal-finance/</guid>
      <description>&lt;p&gt;Y Combinator published their latest &lt;a href=&#34;https://www.ycombinator.com/rfs&#34;&gt;request for startups&lt;/a&gt;, and one area they&amp;rsquo;d want to see startups from is called AI for Personal Finance. I make &lt;a href=&#34;https://within-means.com/&#34;&gt;a personal finance tool&lt;/a&gt;. This post is a brainstorm where AI could enhance it, and the conclusion is it&amp;rsquo;s better if AI is involved on a higher level.&lt;/p&gt;
&lt;h2 id=&#34;what&#34;&gt;What&lt;/h2&gt;
&lt;p&gt;Personal finance tools as I understand them should be very different for people in different financial situations. E.g. what they say on the YC page about investing and tax optimization usually comes after you have your own contingency fund in place. I make a tool to help get there. It takes time and effort, and actions you likely only need to do on this stage. Roughly, this involves&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;figuring out how you spend money,&lt;/li&gt;
&lt;li&gt;finding which parts, if any, you want to cut to put this money into the contingency fund,&lt;/li&gt;
&lt;li&gt;plan your budget and track how well you can stick to it,&lt;/li&gt;
&lt;li&gt;correct your budget, repeat until the fund is formed and your habits don&amp;rsquo;t need to change.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is a bit like forming your eating and activity habits. You don&amp;rsquo;t need to count calories all the time, but you need to understand what you eat and how you should be acting.&lt;/p&gt;
&lt;p&gt;Expense tracking apps usually give you a way to attach categories to your transactions and run some statistics on this info. Some apps also let you plan your spendings beforehand and see how close the plan is to the reality. Recognising behaviour patterns, planning, and plan adjustments are on you.&lt;/p&gt;
&lt;h2 id=&#34;have-you-tried-rubbing-ai-on-it&#34;&gt;Have you tried rubbing AI on it?&lt;/h2&gt;
&lt;p&gt;Pattern recognition is AI&amp;rsquo;s second (or first) name. Even with very little info like an amount spent, category and time, behaviour patterns can be found. If you add calendar and location, more things could be derived. While it could recognise things that don&amp;rsquo;t exist aka hallucinate, you could quickly correct it and not follow recommendations that don&amp;rsquo;t make sense.&lt;/p&gt;
&lt;p&gt;While people are different, there is probably a trick or fifty that will work on most, and there are probably behavioural antipatterns that are better be fixed. This reformulates the task from clustering to classification. People did this even before LLMs with all sorts of playbooks, &lt;a href=&#34;https://github.com/charlax/engineering-management&#34;&gt;especially management&lt;/a&gt;. Why not compiling such a playbook for everyday life and make AI looking for them?&lt;/p&gt;
&lt;p&gt;Several rounds of budgeting and your habits enhancements follow. AI could help you tracking how well the budget is executed, what works and what doesn&amp;rsquo;t. With that in mind, a bit of time thinking about yourself and your situation and where you want to be, you&amp;rsquo;re going to figure it out. Hold on.&lt;/p&gt;
&lt;h2 id=&#34;there-is-a-profession-for-it&#34;&gt;There is a profession for it&lt;/h2&gt;
&lt;p&gt;People are so bad in figuring out themselves they need specialists to help. Those specialists are called psychologists or therapists. And for them this information could be way more useful. Need to figure out patterns that make people unhappy? Here are some suggestions related to money stress, but also there could be activity charts and sleep schedule and diet summary. Oh, and calendar too.&lt;/p&gt;
&lt;p&gt;I wonder if people go to therapists because their life is a mess but don&amp;rsquo;t ever mention how they eat or sleep or spend money because e.g. everyone lives like that. If therapists had a tool to access this info, and optionally find something that resembles certain behaviour, that might be more helpful than giving the same information to people themselves.&lt;/p&gt;
&lt;p&gt;For that to happen, personal finance tools (and health can calendar and whatnot) need to export data to where it&amp;rsquo;s processed. Today every chat interface to LLM supports MCP which is a way to call external tools. Given there are apps that have MCP servers and a decent prompt, therapists probably don&amp;rsquo;t need another LLM wrapper, existing are enough. Which doesn&amp;rsquo;t mean those things won&amp;rsquo;t appear.&lt;/p&gt;
&lt;p&gt;Could AI replace therapists? Eh, I&amp;rsquo;m not qualified to judge from either side, but if I project my programmer experience, AI copilots work way better than AI replacements so far.&lt;/p&gt;
&lt;h2 id=&#34;any-implications-for-within-means&#34;&gt;Any implications for Within Means?&lt;/h2&gt;
&lt;p&gt;No promise. Within Means was intended as a tool that can be done and taken care of on weekends. Making an MCP server and seeing what different LLMs can derive from my behaviour looks doable in a weekend.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=44217809&#34;&gt;This post on hackernews&lt;/a&gt; and &lt;a href=&#34;https://mastodon.online/@smagin/114648650668786649&#34;&gt;Mastodon&lt;/a&gt;&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;Y Combinator published their latest &lt;a href=&#34;https://www.ycombinator.com/rfs&#34;&gt;request for startups&lt;/a&gt;, and one area they&amp;rsquo;d want to see startups from is called AI for Personal Finance. I make &lt;a href=&#34;https://within-means.com/&#34;&gt;a personal finance tool&lt;/a&gt;. This post is a brainstorm where AI could enhance it, and the conclusion is it&amp;rsquo;s better if AI is involved on a higher level.&lt;/p&gt;
&lt;h2 id=&#34;what&#34;&gt;What&lt;/h2&gt;
&lt;p&gt;Personal finance tools as I understand them should be very different for people in different financial situations. E.g. what they say on the YC page about investing and tax optimization usually comes after you have your own contingency fund in place. I make a tool to help get there. It takes time and effort, and actions you likely only need to do on this stage. Roughly, this involves&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;figuring out how you spend money,&lt;/li&gt;
&lt;li&gt;finding which parts, if any, you want to cut to put this money into the contingency fund,&lt;/li&gt;
&lt;li&gt;plan your budget and track how well you can stick to it,&lt;/li&gt;
&lt;li&gt;correct your budget, repeat until the fund is formed and your habits don&amp;rsquo;t need to change.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is a bit like forming your eating and activity habits. You don&amp;rsquo;t need to count calories all the time, but you need to understand what you eat and how you should be acting.&lt;/p&gt;
&lt;p&gt;Expense tracking apps usually give you a way to attach categories to your transactions and run some statistics on this info. Some apps also let you plan your spendings beforehand and see how close the plan is to the reality. Recognising behaviour patterns, planning, and plan adjustments are on you.&lt;/p&gt;
&lt;h2 id=&#34;have-you-tried-rubbing-ai-on-it&#34;&gt;Have you tried rubbing AI on it?&lt;/h2&gt;
&lt;p&gt;Pattern recognition is AI&amp;rsquo;s second (or first) name. Even with very little info like an amount spent, category and time, behaviour patterns can be found. If you add calendar and location, more things could be derived. While it could recognise things that don&amp;rsquo;t exist aka hallucinate, you could quickly correct it and not follow recommendations that don&amp;rsquo;t make sense.&lt;/p&gt;
&lt;p&gt;While people are different, there is probably a trick or fifty that will work on most, and there are probably behavioural antipatterns that are better be fixed. This reformulates the task from clustering to classification. People did this even before LLMs with all sorts of playbooks, &lt;a href=&#34;https://github.com/charlax/engineering-management&#34;&gt;especially management&lt;/a&gt;. Why not compiling such a playbook for everyday life and make AI looking for them?&lt;/p&gt;
&lt;p&gt;Several rounds of budgeting and your habits enhancements follow. AI could help you tracking how well the budget is executed, what works and what doesn&amp;rsquo;t. With that in mind, a bit of time thinking about yourself and your situation and where you want to be, you&amp;rsquo;re going to figure it out. Hold on.&lt;/p&gt;
&lt;h2 id=&#34;there-is-a-profession-for-it&#34;&gt;There is a profession for it&lt;/h2&gt;
&lt;p&gt;People are so bad in figuring out themselves they need specialists to help. Those specialists are called psychologists or therapists. And for them this information could be way more useful. Need to figure out patterns that make people unhappy? Here are some suggestions related to money stress, but also there could be activity charts and sleep schedule and diet summary. Oh, and calendar too.&lt;/p&gt;
&lt;p&gt;I wonder if people go to therapists because their life is a mess but don&amp;rsquo;t ever mention how they eat or sleep or spend money because e.g. everyone lives like that. If therapists had a tool to access this info, and optionally find something that resembles certain behaviour, that might be more helpful than giving the same information to people themselves.&lt;/p&gt;
&lt;p&gt;For that to happen, personal finance tools (and health can calendar and whatnot) need to export data to where it&amp;rsquo;s processed. Today every chat interface to LLM supports MCP which is a way to call external tools. Given there are apps that have MCP servers and a decent prompt, therapists probably don&amp;rsquo;t need another LLM wrapper, existing are enough. Which doesn&amp;rsquo;t mean those things won&amp;rsquo;t appear.&lt;/p&gt;
&lt;p&gt;Could AI replace therapists? Eh, I&amp;rsquo;m not qualified to judge from either side, but if I project my programmer experience, AI copilots work way better than AI replacements so far.&lt;/p&gt;
&lt;h2 id=&#34;any-implications-for-within-means&#34;&gt;Any implications for Within Means?&lt;/h2&gt;
&lt;p&gt;No promise. Within Means was intended as a tool that can be done and taken care of on weekends. Making an MCP server and seeing what different LLMs can derive from my behaviour looks doable in a weekend.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=44217809&#34;&gt;This post on hackernews&lt;/a&gt; and &lt;a href=&#34;https://mastodon.online/@smagin/114648650668786649&#34;&gt;Mastodon&lt;/a&gt;&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Ordinary Life Improvements since 2018</title>
      <link>https://smagin.fyi/posts/ordinary-life-improvements/</link>
      <pubDate>Sun, 25 May 2025 10:31:48 +0200</pubDate>
      <guid>https://smagin.fyi/posts/ordinary-life-improvements/</guid>
      <description>&lt;p&gt;Gwern wrote &lt;a href=&#34;https://gwern.net/improvement&#34;&gt;a post about his ordinary life improvements&lt;/a&gt; in 2018. I feel like now is a good time to write a follow-up.&lt;/p&gt;
&lt;p&gt;Obviously, we&amp;rsquo;re different people who live in different places and have different habits. What&amp;rsquo;s better, people in comments live in other places, and have other habits and hobbies and I hope would bring 10x of what I can think about.&lt;/p&gt;
&lt;p&gt;So, for me, compared to 2018,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Laptops are fast and live all day.&lt;/li&gt;
&lt;li&gt;Smartphones live two days on one charge.&lt;/li&gt;
&lt;li&gt;Noise cancelling headphones are great.&lt;/li&gt;
&lt;li&gt;Dishwasher and robot vacuum remain the best quality of life improvements for home. Both became a lot better but not necessarily cheaper.&lt;/li&gt;
&lt;li&gt;Washing machines with dryers slowly improve.&lt;/li&gt;
&lt;li&gt;Air conditioners got better and quieter.&lt;/li&gt;
&lt;li&gt;Air purifiers and humidifiers are affordable and save a lot of annoyance during winters.&lt;/li&gt;
&lt;li&gt;International shipping is mostly sorted. I live in Serbia and can order almost anything I want.&lt;/li&gt;
&lt;li&gt;Map apps mostly know about public transport, taxi apps exist almost everywhere.&lt;/li&gt;
&lt;li&gt;Neural networks are actually helpful (sometimes).&lt;/li&gt;
&lt;li&gt;Teeth aligners (as in invisalign) are affordable and a lot less annoying than braces. Probably made many people fix their teeth and learn the hygienic routine and go for checkups regularly.&lt;/li&gt;
&lt;li&gt;From what I can tell, other dentist devices are better, cheaper, and more compact than before.&lt;/li&gt;
&lt;li&gt;Specialty coffee is everywhere. I guess people learned to grow and transport it, and there is enough demand for it too. You can also get yourself a grinder and an expresso machine for $500 combined and get decent coffee at home. You can order coffee too if you don&amp;rsquo;t have a coffeeshop nearby.&lt;/li&gt;
&lt;li&gt;It&amp;rsquo;s easy to rent a car with automatic transmission and a rear camera for parking even in Serbia.&lt;/li&gt;
&lt;li&gt;Hair transplantation is affordable and &lt;a href=&#34;https://www.nhs.uk/conditions/cosmetic-procedures/cosmetic-surgery/hair-transplant/&#34;&gt;not risky&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Eye surgery is affordable and &lt;a href=&#34;https://www.manhattaneyenyc.com/how-safe-is-smile-laser-eye-surgery-a-comprehensive-look-at-the-safety-and-efficacy-of-this-vision-correction-procedure/&#34;&gt;not risky&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Laser epilation is not new but I guess more affordable too. Electrology aka permanent very painful hair removal exists.&lt;/li&gt;
&lt;li&gt;USB-C is everywhere, for all the devices. Even scales, even trimmers, even water picks.&lt;/li&gt;
&lt;li&gt;Automatic passport control gates are increasingly common, I guess one of the consequences of widespread biometric passports. Another consequence of that is the ability to scan that NFC chip in your passport with your phone and use the result as an identity confirmation. Some e-gov apps already do that.&lt;/li&gt;
&lt;li&gt;Your local grocery shop is probably redesigned to look much better.&lt;/li&gt;
&lt;li&gt;Serbia got a fast cheap reliable frequent train between Belgrade and Novi Sad, now extended to Subotica, hopefully next year extended to Budapest. Bus / tram are synchronised with train in all those cities.&lt;/li&gt;
&lt;li&gt;Belgrade is having a boom of cafes and restaurants and coffeeshops and bakeries.&lt;/li&gt;
&lt;li&gt;Ikea + flea markets sorted most of the furniture and home decoration. Probably happened before 2018 generally but not for me.&lt;/li&gt;
&lt;li&gt;Local-first apps fade and telegram bots allowed simpler apps where you can skip doing big chunks of work yet don&amp;rsquo;t compromise on UX. Vibe coding is attacking the problem from another angle.&lt;/li&gt;
&lt;li&gt;Remote work is not exotic anymore.&lt;/li&gt;
&lt;li&gt;Psychologists are not exotic anymore.&lt;/li&gt;
&lt;li&gt;Meditation doesn&amp;rsquo;t have to come with the rest of the religion.&lt;/li&gt;
&lt;li&gt;Videocalls became good. Helps at work and to call parents.&lt;/li&gt;
&lt;li&gt;Self-service cachiers are good and fast and work every time and are everywhere. Made your next door shopping so much faster.&lt;/li&gt;
&lt;li&gt;All things cameras became better and more affordable. Cameras themselves, tripods, mounts, lights, processing programs.&lt;/li&gt;
&lt;li&gt;Figma is a web design tool a programmer can use, and a wannabe designer can start with. I don&amp;rsquo;t even know what people used before that but it was a lot scarier to try.&lt;/li&gt;
&lt;li&gt;Spaced repetition &lt;a href=&#34;https://domenic.me/fsrs/&#34;&gt;got even better&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;SWIFT money transfers suddenly started to be processed within a day. I&amp;rsquo;d love to hear a story behind that.&lt;/li&gt;
&lt;li&gt;Some sort of the small internet revival is happening vs people spending their time exclusively in 5-ish social networks. People again started having their blogs and forums and clubs and art projects on their websites, and other people find them and make their newsletters and it&amp;rsquo;s all so cute and human and brings me joy and will to make something myself.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; &lt;a href=&#34;https://news.ycombinator.com/item?id=22450751&#34;&gt;One of the popular comments on hackernews&lt;/a&gt; was that more important things were getting worse. I agree, and some of the important things are still getting worse and for me personally 2019 was the best year so far. That&amp;rsquo;s fine, more important things will recover, and these tiny everyday conveniences will stay and improve further. Cheers.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=44089031&#34;&gt;This post on hackernews&lt;/a&gt;&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;Gwern wrote &lt;a href=&#34;https://gwern.net/improvement&#34;&gt;a post about his ordinary life improvements&lt;/a&gt; in 2018. I feel like now is a good time to write a follow-up.&lt;/p&gt;
&lt;p&gt;Obviously, we&amp;rsquo;re different people who live in different places and have different habits. What&amp;rsquo;s better, people in comments live in other places, and have other habits and hobbies and I hope would bring 10x of what I can think about.&lt;/p&gt;
&lt;p&gt;So, for me, compared to 2018,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Laptops are fast and live all day.&lt;/li&gt;
&lt;li&gt;Smartphones live two days on one charge.&lt;/li&gt;
&lt;li&gt;Noise cancelling headphones are great.&lt;/li&gt;
&lt;li&gt;Dishwasher and robot vacuum remain the best quality of life improvements for home. Both became a lot better but not necessarily cheaper.&lt;/li&gt;
&lt;li&gt;Washing machines with dryers slowly improve.&lt;/li&gt;
&lt;li&gt;Air conditioners got better and quieter.&lt;/li&gt;
&lt;li&gt;Air purifiers and humidifiers are affordable and save a lot of annoyance during winters.&lt;/li&gt;
&lt;li&gt;International shipping is mostly sorted. I live in Serbia and can order almost anything I want.&lt;/li&gt;
&lt;li&gt;Map apps mostly know about public transport, taxi apps exist almost everywhere.&lt;/li&gt;
&lt;li&gt;Neural networks are actually helpful (sometimes).&lt;/li&gt;
&lt;li&gt;Teeth aligners (as in invisalign) are affordable and a lot less annoying than braces. Probably made many people fix their teeth and learn the hygienic routine and go for checkups regularly.&lt;/li&gt;
&lt;li&gt;From what I can tell, other dentist devices are better, cheaper, and more compact than before.&lt;/li&gt;
&lt;li&gt;Specialty coffee is everywhere. I guess people learned to grow and transport it, and there is enough demand for it too. You can also get yourself a grinder and an expresso machine for $500 combined and get decent coffee at home. You can order coffee too if you don&amp;rsquo;t have a coffeeshop nearby.&lt;/li&gt;
&lt;li&gt;It&amp;rsquo;s easy to rent a car with automatic transmission and a rear camera for parking even in Serbia.&lt;/li&gt;
&lt;li&gt;Hair transplantation is affordable and &lt;a href=&#34;https://www.nhs.uk/conditions/cosmetic-procedures/cosmetic-surgery/hair-transplant/&#34;&gt;not risky&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Eye surgery is affordable and &lt;a href=&#34;https://www.manhattaneyenyc.com/how-safe-is-smile-laser-eye-surgery-a-comprehensive-look-at-the-safety-and-efficacy-of-this-vision-correction-procedure/&#34;&gt;not risky&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Laser epilation is not new but I guess more affordable too. Electrology aka permanent very painful hair removal exists.&lt;/li&gt;
&lt;li&gt;USB-C is everywhere, for all the devices. Even scales, even trimmers, even water picks.&lt;/li&gt;
&lt;li&gt;Automatic passport control gates are increasingly common, I guess one of the consequences of widespread biometric passports. Another consequence of that is the ability to scan that NFC chip in your passport with your phone and use the result as an identity confirmation. Some e-gov apps already do that.&lt;/li&gt;
&lt;li&gt;Your local grocery shop is probably redesigned to look much better.&lt;/li&gt;
&lt;li&gt;Serbia got a fast cheap reliable frequent train between Belgrade and Novi Sad, now extended to Subotica, hopefully next year extended to Budapest. Bus / tram are synchronised with train in all those cities.&lt;/li&gt;
&lt;li&gt;Belgrade is having a boom of cafes and restaurants and coffeeshops and bakeries.&lt;/li&gt;
&lt;li&gt;Ikea + flea markets sorted most of the furniture and home decoration. Probably happened before 2018 generally but not for me.&lt;/li&gt;
&lt;li&gt;Local-first apps fade and telegram bots allowed simpler apps where you can skip doing big chunks of work yet don&amp;rsquo;t compromise on UX. Vibe coding is attacking the problem from another angle.&lt;/li&gt;
&lt;li&gt;Remote work is not exotic anymore.&lt;/li&gt;
&lt;li&gt;Psychologists are not exotic anymore.&lt;/li&gt;
&lt;li&gt;Meditation doesn&amp;rsquo;t have to come with the rest of the religion.&lt;/li&gt;
&lt;li&gt;Videocalls became good. Helps at work and to call parents.&lt;/li&gt;
&lt;li&gt;Self-service cachiers are good and fast and work every time and are everywhere. Made your next door shopping so much faster.&lt;/li&gt;
&lt;li&gt;All things cameras became better and more affordable. Cameras themselves, tripods, mounts, lights, processing programs.&lt;/li&gt;
&lt;li&gt;Figma is a web design tool a programmer can use, and a wannabe designer can start with. I don&amp;rsquo;t even know what people used before that but it was a lot scarier to try.&lt;/li&gt;
&lt;li&gt;Spaced repetition &lt;a href=&#34;https://domenic.me/fsrs/&#34;&gt;got even better&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;SWIFT money transfers suddenly started to be processed within a day. I&amp;rsquo;d love to hear a story behind that.&lt;/li&gt;
&lt;li&gt;Some sort of the small internet revival is happening vs people spending their time exclusively in 5-ish social networks. People again started having their blogs and forums and clubs and art projects on their websites, and other people find them and make their newsletters and it&amp;rsquo;s all so cute and human and brings me joy and will to make something myself.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Sidenote:&lt;/strong&gt; &lt;a href=&#34;https://news.ycombinator.com/item?id=22450751&#34;&gt;One of the popular comments on hackernews&lt;/a&gt; was that more important things were getting worse. I agree, and some of the important things are still getting worse and for me personally 2019 was the best year so far. That&amp;rsquo;s fine, more important things will recover, and these tiny everyday conveniences will stay and improve further. Cheers.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=44089031&#34;&gt;This post on hackernews&lt;/a&gt;&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>I Need your Help to Improve Money Formatting on the Internet</title>
      <link>https://smagin.fyi/posts/money-formatting/</link>
      <pubDate>Sun, 06 Apr 2025 10:06:50 +0100</pubDate>
      <guid>https://smagin.fyi/posts/money-formatting/</guid>
      <description>&lt;p&gt;I noticed the other day that a popular ruby library for all things money, &lt;code&gt;Money&lt;/code&gt;, formats Serbian Dinar incorrectly. I spent several evenings to learn and describe what the correct formatting would be and how to achieve that. The answer requires croudsourcing, which you probably figured already.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unicode categorised it all;&lt;/li&gt;
&lt;li&gt;ECMA 402 contains lots of wisdom;&lt;/li&gt;
&lt;li&gt;if you make a money formatting library, make sure it uses CLDR;&lt;/li&gt;
&lt;li&gt;if you know about a less popular currency or language more than most, check if CLDR is correct.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Update 10.01.2026:&lt;/strong&gt; most of the PRs I mentioned are merged now, thanks everyone for reviewing them. Honorable mention: &lt;a href=&#34;https://unicode-org.atlassian.net/browse/CLDR-19119&#34;&gt;this ticket&lt;/a&gt; by Božidar Markovinović that got the things going for Unicode, and ofc Peter Edberg who got the thing implemented and merged.&lt;/p&gt;
&lt;h2 id=&#34;money-formatting-depends-on-locale&#34;&gt;Money formatting depends on locale&lt;/h2&gt;
&lt;p&gt;If you ever thought about formatting money, you probably fell into a bunch of traps listed in the &lt;a href=&#34;https://gist.github.com/rgs/6509585&#34;&gt;falsehoods programmers believe about prices&lt;/a&gt;. This list illustrates how countries have different currencies, and how different languages format currencies differently.&lt;/p&gt;
&lt;p&gt;One falsehood some popular libraries still implement is to mistake the second statement as &amp;ldquo;we should format money depending on the currency&amp;rdquo;. This may or may not be obviously false to you, but I certainly believed that few weeks ago. I was wrong.&lt;/p&gt;
&lt;p&gt;Sidenote: &lt;em&gt;falsehoods programmers believe&lt;/em&gt; is a genre, go explore it.&lt;/p&gt;
&lt;p&gt;Number formatting is a part of orthography which is part of writing which is a representation of a language. Representations of different languages vary, and there could be multiple representations of the same languages. In software we choose writing as part of setting locale.&lt;/p&gt;
&lt;p&gt;Locales include a bunch of standards based usually on language and region or writing system. The list of locales is currently &lt;a href=&#34;https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/availableLocales.json&#34;&gt;defined in Unicode&lt;/a&gt;. Things that are included into locales which are not parts of writing systems could be standard paper size, or temperature and other measurements, or words. Things that are part of both are, for example, datetime, numbers, and currencies.&lt;/p&gt;
&lt;p&gt;Sidenote: There are 9 locales for the Serbian language, 26 for Arabic, 121 for English, and 739 in total.&lt;/p&gt;
&lt;p&gt;Example: same amount of money formatted for different locales:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$12,345.42    # en_US
12.345,42 $   # fr_FR
12 345,42 $   # ru_ru
USD 12,345.42 # es_MX, $ stands for Mexican Peso here
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; Sometimes thin space is used either instead of space as thousands separator or between currency symbol and number. Example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;12 345 ¥&lt;/li&gt;
&lt;li&gt;12 345 ¥   ← thin spaces here&lt;/li&gt;
&lt;li&gt;12345¥&lt;/li&gt;
&lt;li&gt;£12,000&lt;/li&gt;
&lt;li&gt;£ 12,000   ← and here&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thin spaces are sometimes used to format phone numbers as well.&lt;/p&gt;
&lt;p&gt;Certainly if there are standards, there are libraries to which you can feed the locale and a price, and they will format it for you. How do they know how to do that and avoid The Falsehoods?&lt;/p&gt;
&lt;p&gt;The answer is croudsourcing and curation.&lt;/p&gt;
&lt;h2 id=&#34;there-is-a-good-dataset-on-locales&#34;&gt;There is a good dataset on locales&lt;/h2&gt;
&lt;p&gt;Unicode is the organization that once standardised text encoding to UTF-8 and adds new emojis into it for the last 10 years. It&amp;rsquo;s also the organization that builds the &lt;a href=&#34;https://github.com/unicode-org/cldr-json/&#34;&gt;Common Language Data Repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Common language data is many things. I suggest that you explore it. From the money formatting perspective, they have&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;names and symbols for different currencies in different languages,&lt;/li&gt;
&lt;li&gt;how to write a number using words,&lt;/li&gt;
&lt;li&gt;how to round a currency,&lt;/li&gt;
&lt;li&gt;the format itself.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sidenote: datasets I looked at are &lt;code&gt;cldr-numbers-full&lt;/code&gt; and &lt;code&gt;cldr-code -&amp;gt; supplemental -&amp;gt; currencyData&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a lot of data not many people know about if you ask them on the street. Unicode uses help of many people, performs surveys, and has an Jira that everyone can a ticket in if they noticed something wrong. Things change across the world and the dataset is not perfect, but it&amp;rsquo;s the closest to the perfect I&amp;rsquo;ve met and everyone should use this data.&lt;/p&gt;
&lt;p&gt;If you checked your language there and found a mistake, go complain &lt;a href=&#34;https://unicode-org.atlassian.net/browse/CLDR-18446&#34;&gt;on their Jira&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;there-is-a-good-spec-for-money-formatting&#34;&gt;There is a good spec for money formatting&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://402.ecma-international.org/11.0/index.html#scope&#34;&gt;ECMA 402&lt;/a&gt; spec is part of javascript specification that defines all things internationalisation, including number and currency formatting.&lt;/p&gt;
&lt;p&gt;You can see the implementation of this spec in your browser of choice,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Intl.NumberFormat(&amp;#34;sr-el&amp;#34;, { style: &amp;#34;currency&amp;#34;, currency: &amp;#34;RSD&amp;#34; }).format(12345.42)
// =&amp;gt; &amp;#34;12.345,42 RSD&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That implementation is hopefully based on the unicode CLDR dataset. &lt;a href=&#34;https://chromium.googlesource.com/chromium/src/&amp;#43;/HEAD/third_party/cldr/README.chromium&#34;&gt;Chrome&lt;/a&gt;, &lt;a href=&#34;https://bugs.webkit.org/show_bug.cgi?id=252239&#34;&gt;Safari&lt;/a&gt; and &lt;a href=&#34;https://blog.mozilla.org/l10n/2018/04/10/cldr-as-source-of-key-internationalization-data-in-firefox-milestones-achieved-and-next-steps/&#34;&gt;Firefox&lt;/a&gt; do that for sure, but maybe not every browser uses the latest data, and probably browsers post-process it differently, because people do &lt;a href=&#34;https://stackoverflow.com/questions/75272194/intl-numberformat-returns-different-results-between-safari-and-chrome-for-exact&#34;&gt;see the difference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The spec suggests a vast number of options for the &lt;code&gt;NumberFormat&lt;/code&gt; which clearly comes from facing the reality of many languages and areas where numbers are formatted. Look at the possible rounding modes:
&lt;code&gt;ceil, floor, expand, trunc, halfCeil, halfFloor, halfExpand, halfTrunc, halfEven&lt;/code&gt;. If I were making an i18n library, I would definitely implement this spec.&lt;/p&gt;
&lt;h2 id=&#34;i18n-libraries-are-more-than-number-formatting&#34;&gt;I18n libraries are more than number formatting&lt;/h2&gt;
&lt;p&gt;When you think about an i18n library, you&amp;rsquo;re thinking about words first, and words are usually translated during app development, and the library work is usually to provide a convenient helper that takes a translation key, figure out the locale and return a value for the key.&lt;/p&gt;
&lt;p&gt;More mature ecosystems figured common patterns across the apps, put them into frameworks and components, and translated them. For example, Ruby on Rails has a whole set of translations that come with the framework, and more translations come from libraries. At this point people who are not aware of CLDR or started before it became a thing (which was in 2003) start to duplicate its work.&lt;/p&gt;
&lt;p&gt;Please don&amp;rsquo;t. It&amp;rsquo;s a huge amount of work, people refine it for 21 years now. Another thing, you&amp;rsquo;ll be put in a position to choose between your contributors data and CLDR data one day. Instead, try to make a mapping between your translation keys and CLDR data and automatically update your app based on that. If you already have conflicts, try to resolve them with help of native speakers and either just override your translations or contribute to CLDR.&lt;/p&gt;
&lt;p&gt;Knowing all that, let&amp;rsquo;s get back to the thing that made me learn it and help with what I can.&lt;/p&gt;
&lt;h2 id=&#34;the-internet-is-wrong-about-money-formatting-in-serbian&#34;&gt;The Internet is wrong about money formatting in Serbian&lt;/h2&gt;
&lt;p&gt;So, ruby &lt;code&gt;Money&lt;/code&gt; gem formats Serbian Dinar incorrectly.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; Money.from_amount(12345.42, &amp;#34;RSD&amp;#34;).format
=&amp;gt; &amp;#34;РСД12,345.42&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;First of, it formats based on currency instead of locale. To be fair, it throws a warning about that and says that it&amp;rsquo;s going to move to locale-based formatting from the next major version. That&amp;rsquo;s a good and right move.&lt;/p&gt;
&lt;p&gt;They are still going to support the old way of formatting though, so let&amp;rsquo;s see what is wrong with that and fix it.&lt;/p&gt;
&lt;p&gt;The correct formatting would be &lt;code&gt;12.345,42 RSD&lt;/code&gt;. Differences are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Currency symbol is wrong (more on that later)&lt;/li&gt;
&lt;li&gt;Currency symbol should go after the the number&lt;/li&gt;
&lt;li&gt;There should be a space between the number and the symbol&lt;/li&gt;
&lt;li&gt;Comma is used as a decimal, and dot is used as a thousands separator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;How do I know that? I asked. I also googled but wasn&amp;rsquo;t convinced with the results:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Nobody cares&#34; src=&#34; /pics/money-formatting-rsd.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Additionally, on the unicode dataset I noticed that according to it RSD has 0 digits in the fractional part, when it&amp;rsquo;s actually two, but there are no &lt;em&gt;para&lt;/em&gt; (Serbian cents) coins minted anymore so if you pay in cash, it&amp;rsquo;s rounded.&lt;/p&gt;
&lt;p&gt;Clearly, I needed an autority. So I wrote to the People&amp;rsquo;s Bank of Serbia. And to the Institute of Serbian language. And to my friend philologist Borislava. Two out of three answered.&lt;/p&gt;
&lt;p&gt;So here is the thing. Serbian has 9 locales, and even if we narrow down to only two it&amp;rsquo;s confusing enough. The two are &lt;code&gt;sr-el&lt;/code&gt; (latin) and &lt;code&gt;sr-ec&lt;/code&gt; (cyrillic). If there is a Serbian language in a library it&amp;rsquo;s usually the cyrillic one.&lt;/p&gt;
&lt;p&gt;Serbian dinar ISO code is &lt;code&gt;RSD&lt;/code&gt;. Your best bet outside of Serbia for it to be recognized is RSD. At the same time, cyrillic text would use the cyrillic notation &lt;code&gt;РСД&lt;/code&gt;. Then there are symbols that are non-standard but people use anyway. I found 4 for each writing: &lt;code&gt;DIN, Din, Din., din., ДИН, Дин, Дин., дин.&lt;/code&gt;. Currency symbol goes after the number.&lt;/p&gt;
&lt;p&gt;Serbian orthography for number formatting is described in a special book and extract from it are posted across the Internet. Thanks to all these fine people because it&amp;rsquo;s very inconvenient to grep books.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kakosepise.net/srpski-jezik/pravopis/brojevi/&#34;&gt;How to format numbers in Serbian&lt;/a&gt;: &lt;code&gt;12.345,42&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Rounding of dinars depends on if you&amp;rsquo;re performing the operation in cash or digitally. There are no &lt;em&gt;para&lt;/em&gt; coins, so the bill is rounded to the nearest dinar: &lt;code&gt;0.50 -&amp;gt; 0, 0.51 -&amp;gt; 1&lt;/code&gt;. This rounding method is called Half Down and corresponds to &lt;code&gt;halfFloor&lt;/code&gt; in ECMA 402. For cashless operations, precision is &lt;code&gt;0.01 RSD&lt;/code&gt;. Bank of Serbia told me that, but I can confirm that from the experience of living in Serbia. Also, this is where the unicode dataset is slightly wrong, and I reported it to their Jira.&lt;/p&gt;
&lt;p&gt;All in all, here are the PRs I created so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/RubyMoney/money/pull/1124&#34;&gt;RSD formatting for ruby Money&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/svenfuchs/rails-i18n/pull/1140&#34;&gt;sr-el fixes for rails-i18n&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://unicode-org.atlassian.net/browse/CLDR-18446&#34;&gt;CLDR JIRA ticket for digits&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;call-to-action&#34;&gt;Call to Action&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re making an i18n library, thank you so much. It&amp;rsquo;s one of the things that requires effort of many people and curation from someone with a lot of patience. Some of the things that can be automated like numbers and dates formatting is done in CLDR and I suggest that you use this data, unless you already do. If there is a conflicting data, please resolve the conflicts and contribute to CLDR.&lt;/p&gt;
&lt;p&gt;If you use a library that can format money, please check that it does that based on locales, and please check that Serbian formatting is fine. If it&amp;rsquo;s not, please complain in their github, and maybe it means that they don&amp;rsquo;t use CLDR and you could complain about that as well.&lt;/p&gt;
&lt;p&gt;Finally, if you live in a small country or speak a less popular language, go check if CLDR is correct about it.&lt;/p&gt;
&lt;p&gt;Thanks everyone.&lt;/p&gt;
&lt;p&gt;Sources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/unicode-org/cldr-json&#34;&gt;Unicode CLDR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://english.stackexchange.com/questions/388543/are-spelling-punctuation-and-capitalization-part-of-grammar&#34;&gt;Spelling and punctuation are not part of grammar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gist.github.com/rgs/6509585&#34;&gt;Falsehoods programmers believe about prices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Locale_%28computer_software%29&#34;&gt;Wikipedia about locales&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/availableLocales.json&#34;&gt;The list of locales&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://402.ecma-international.org/11.0/index.html#scope&#34;&gt;ECMA 402&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kakosepise.net/srpski-jezik/pravopis/brojevi/&#34;&gt;How to format numbers in Serbian&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=43601224&#34;&gt;This post on hackernews&lt;/a&gt;&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;I noticed the other day that a popular ruby library for all things money, &lt;code&gt;Money&lt;/code&gt;, formats Serbian Dinar incorrectly. I spent several evenings to learn and describe what the correct formatting would be and how to achieve that. The answer requires croudsourcing, which you probably figured already.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unicode categorised it all;&lt;/li&gt;
&lt;li&gt;ECMA 402 contains lots of wisdom;&lt;/li&gt;
&lt;li&gt;if you make a money formatting library, make sure it uses CLDR;&lt;/li&gt;
&lt;li&gt;if you know about a less popular currency or language more than most, check if CLDR is correct.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Update 10.01.2026:&lt;/strong&gt; most of the PRs I mentioned are merged now, thanks everyone for reviewing them. Honorable mention: &lt;a href=&#34;https://unicode-org.atlassian.net/browse/CLDR-19119&#34;&gt;this ticket&lt;/a&gt; by Božidar Markovinović that got the things going for Unicode, and ofc Peter Edberg who got the thing implemented and merged.&lt;/p&gt;
&lt;h2 id=&#34;money-formatting-depends-on-locale&#34;&gt;Money formatting depends on locale&lt;/h2&gt;
&lt;p&gt;If you ever thought about formatting money, you probably fell into a bunch of traps listed in the &lt;a href=&#34;https://gist.github.com/rgs/6509585&#34;&gt;falsehoods programmers believe about prices&lt;/a&gt;. This list illustrates how countries have different currencies, and how different languages format currencies differently.&lt;/p&gt;
&lt;p&gt;One falsehood some popular libraries still implement is to mistake the second statement as &amp;ldquo;we should format money depending on the currency&amp;rdquo;. This may or may not be obviously false to you, but I certainly believed that few weeks ago. I was wrong.&lt;/p&gt;
&lt;p&gt;Sidenote: &lt;em&gt;falsehoods programmers believe&lt;/em&gt; is a genre, go explore it.&lt;/p&gt;
&lt;p&gt;Number formatting is a part of orthography which is part of writing which is a representation of a language. Representations of different languages vary, and there could be multiple representations of the same languages. In software we choose writing as part of setting locale.&lt;/p&gt;
&lt;p&gt;Locales include a bunch of standards based usually on language and region or writing system. The list of locales is currently &lt;a href=&#34;https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/availableLocales.json&#34;&gt;defined in Unicode&lt;/a&gt;. Things that are included into locales which are not parts of writing systems could be standard paper size, or temperature and other measurements, or words. Things that are part of both are, for example, datetime, numbers, and currencies.&lt;/p&gt;
&lt;p&gt;Sidenote: There are 9 locales for the Serbian language, 26 for Arabic, 121 for English, and 739 in total.&lt;/p&gt;
&lt;p&gt;Example: same amount of money formatted for different locales:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$12,345.42    # en_US
12.345,42 $   # fr_FR
12 345,42 $   # ru_ru
USD 12,345.42 # es_MX, $ stands for Mexican Peso here
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; Sometimes thin space is used either instead of space as thousands separator or between currency symbol and number. Example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;12 345 ¥&lt;/li&gt;
&lt;li&gt;12 345 ¥   ← thin spaces here&lt;/li&gt;
&lt;li&gt;12345¥&lt;/li&gt;
&lt;li&gt;£12,000&lt;/li&gt;
&lt;li&gt;£ 12,000   ← and here&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thin spaces are sometimes used to format phone numbers as well.&lt;/p&gt;
&lt;p&gt;Certainly if there are standards, there are libraries to which you can feed the locale and a price, and they will format it for you. How do they know how to do that and avoid The Falsehoods?&lt;/p&gt;
&lt;p&gt;The answer is croudsourcing and curation.&lt;/p&gt;
&lt;h2 id=&#34;there-is-a-good-dataset-on-locales&#34;&gt;There is a good dataset on locales&lt;/h2&gt;
&lt;p&gt;Unicode is the organization that once standardised text encoding to UTF-8 and adds new emojis into it for the last 10 years. It&amp;rsquo;s also the organization that builds the &lt;a href=&#34;https://github.com/unicode-org/cldr-json/&#34;&gt;Common Language Data Repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Common language data is many things. I suggest that you explore it. From the money formatting perspective, they have&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;names and symbols for different currencies in different languages,&lt;/li&gt;
&lt;li&gt;how to write a number using words,&lt;/li&gt;
&lt;li&gt;how to round a currency,&lt;/li&gt;
&lt;li&gt;the format itself.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sidenote: datasets I looked at are &lt;code&gt;cldr-numbers-full&lt;/code&gt; and &lt;code&gt;cldr-code -&amp;gt; supplemental -&amp;gt; currencyData&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a lot of data not many people know about if you ask them on the street. Unicode uses help of many people, performs surveys, and has an Jira that everyone can a ticket in if they noticed something wrong. Things change across the world and the dataset is not perfect, but it&amp;rsquo;s the closest to the perfect I&amp;rsquo;ve met and everyone should use this data.&lt;/p&gt;
&lt;p&gt;If you checked your language there and found a mistake, go complain &lt;a href=&#34;https://unicode-org.atlassian.net/browse/CLDR-18446&#34;&gt;on their Jira&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;there-is-a-good-spec-for-money-formatting&#34;&gt;There is a good spec for money formatting&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://402.ecma-international.org/11.0/index.html#scope&#34;&gt;ECMA 402&lt;/a&gt; spec is part of javascript specification that defines all things internationalisation, including number and currency formatting.&lt;/p&gt;
&lt;p&gt;You can see the implementation of this spec in your browser of choice,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;Intl.NumberFormat(&amp;#34;sr-el&amp;#34;, { style: &amp;#34;currency&amp;#34;, currency: &amp;#34;RSD&amp;#34; }).format(12345.42)
// =&amp;gt; &amp;#34;12.345,42 RSD&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That implementation is hopefully based on the unicode CLDR dataset. &lt;a href=&#34;https://chromium.googlesource.com/chromium/src/&amp;#43;/HEAD/third_party/cldr/README.chromium&#34;&gt;Chrome&lt;/a&gt;, &lt;a href=&#34;https://bugs.webkit.org/show_bug.cgi?id=252239&#34;&gt;Safari&lt;/a&gt; and &lt;a href=&#34;https://blog.mozilla.org/l10n/2018/04/10/cldr-as-source-of-key-internationalization-data-in-firefox-milestones-achieved-and-next-steps/&#34;&gt;Firefox&lt;/a&gt; do that for sure, but maybe not every browser uses the latest data, and probably browsers post-process it differently, because people do &lt;a href=&#34;https://stackoverflow.com/questions/75272194/intl-numberformat-returns-different-results-between-safari-and-chrome-for-exact&#34;&gt;see the difference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The spec suggests a vast number of options for the &lt;code&gt;NumberFormat&lt;/code&gt; which clearly comes from facing the reality of many languages and areas where numbers are formatted. Look at the possible rounding modes:
&lt;code&gt;ceil, floor, expand, trunc, halfCeil, halfFloor, halfExpand, halfTrunc, halfEven&lt;/code&gt;. If I were making an i18n library, I would definitely implement this spec.&lt;/p&gt;
&lt;h2 id=&#34;i18n-libraries-are-more-than-number-formatting&#34;&gt;I18n libraries are more than number formatting&lt;/h2&gt;
&lt;p&gt;When you think about an i18n library, you&amp;rsquo;re thinking about words first, and words are usually translated during app development, and the library work is usually to provide a convenient helper that takes a translation key, figure out the locale and return a value for the key.&lt;/p&gt;
&lt;p&gt;More mature ecosystems figured common patterns across the apps, put them into frameworks and components, and translated them. For example, Ruby on Rails has a whole set of translations that come with the framework, and more translations come from libraries. At this point people who are not aware of CLDR or started before it became a thing (which was in 2003) start to duplicate its work.&lt;/p&gt;
&lt;p&gt;Please don&amp;rsquo;t. It&amp;rsquo;s a huge amount of work, people refine it for 21 years now. Another thing, you&amp;rsquo;ll be put in a position to choose between your contributors data and CLDR data one day. Instead, try to make a mapping between your translation keys and CLDR data and automatically update your app based on that. If you already have conflicts, try to resolve them with help of native speakers and either just override your translations or contribute to CLDR.&lt;/p&gt;
&lt;p&gt;Knowing all that, let&amp;rsquo;s get back to the thing that made me learn it and help with what I can.&lt;/p&gt;
&lt;h2 id=&#34;the-internet-is-wrong-about-money-formatting-in-serbian&#34;&gt;The Internet is wrong about money formatting in Serbian&lt;/h2&gt;
&lt;p&gt;So, ruby &lt;code&gt;Money&lt;/code&gt; gem formats Serbian Dinar incorrectly.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;gt; Money.from_amount(12345.42, &amp;#34;RSD&amp;#34;).format
=&amp;gt; &amp;#34;РСД12,345.42&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;First of, it formats based on currency instead of locale. To be fair, it throws a warning about that and says that it&amp;rsquo;s going to move to locale-based formatting from the next major version. That&amp;rsquo;s a good and right move.&lt;/p&gt;
&lt;p&gt;They are still going to support the old way of formatting though, so let&amp;rsquo;s see what is wrong with that and fix it.&lt;/p&gt;
&lt;p&gt;The correct formatting would be &lt;code&gt;12.345,42 RSD&lt;/code&gt;. Differences are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Currency symbol is wrong (more on that later)&lt;/li&gt;
&lt;li&gt;Currency symbol should go after the the number&lt;/li&gt;
&lt;li&gt;There should be a space between the number and the symbol&lt;/li&gt;
&lt;li&gt;Comma is used as a decimal, and dot is used as a thousands separator&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;How do I know that? I asked. I also googled but wasn&amp;rsquo;t convinced with the results:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;Nobody cares&#34; src=&#34; /pics/money-formatting-rsd.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Additionally, on the unicode dataset I noticed that according to it RSD has 0 digits in the fractional part, when it&amp;rsquo;s actually two, but there are no &lt;em&gt;para&lt;/em&gt; (Serbian cents) coins minted anymore so if you pay in cash, it&amp;rsquo;s rounded.&lt;/p&gt;
&lt;p&gt;Clearly, I needed an autority. So I wrote to the People&amp;rsquo;s Bank of Serbia. And to the Institute of Serbian language. And to my friend philologist Borislava. Two out of three answered.&lt;/p&gt;
&lt;p&gt;So here is the thing. Serbian has 9 locales, and even if we narrow down to only two it&amp;rsquo;s confusing enough. The two are &lt;code&gt;sr-el&lt;/code&gt; (latin) and &lt;code&gt;sr-ec&lt;/code&gt; (cyrillic). If there is a Serbian language in a library it&amp;rsquo;s usually the cyrillic one.&lt;/p&gt;
&lt;p&gt;Serbian dinar ISO code is &lt;code&gt;RSD&lt;/code&gt;. Your best bet outside of Serbia for it to be recognized is RSD. At the same time, cyrillic text would use the cyrillic notation &lt;code&gt;РСД&lt;/code&gt;. Then there are symbols that are non-standard but people use anyway. I found 4 for each writing: &lt;code&gt;DIN, Din, Din., din., ДИН, Дин, Дин., дин.&lt;/code&gt;. Currency symbol goes after the number.&lt;/p&gt;
&lt;p&gt;Serbian orthography for number formatting is described in a special book and extract from it are posted across the Internet. Thanks to all these fine people because it&amp;rsquo;s very inconvenient to grep books.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://kakosepise.net/srpski-jezik/pravopis/brojevi/&#34;&gt;How to format numbers in Serbian&lt;/a&gt;: &lt;code&gt;12.345,42&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Rounding of dinars depends on if you&amp;rsquo;re performing the operation in cash or digitally. There are no &lt;em&gt;para&lt;/em&gt; coins, so the bill is rounded to the nearest dinar: &lt;code&gt;0.50 -&amp;gt; 0, 0.51 -&amp;gt; 1&lt;/code&gt;. This rounding method is called Half Down and corresponds to &lt;code&gt;halfFloor&lt;/code&gt; in ECMA 402. For cashless operations, precision is &lt;code&gt;0.01 RSD&lt;/code&gt;. Bank of Serbia told me that, but I can confirm that from the experience of living in Serbia. Also, this is where the unicode dataset is slightly wrong, and I reported it to their Jira.&lt;/p&gt;
&lt;p&gt;All in all, here are the PRs I created so far:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/RubyMoney/money/pull/1124&#34;&gt;RSD formatting for ruby Money&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/svenfuchs/rails-i18n/pull/1140&#34;&gt;sr-el fixes for rails-i18n&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://unicode-org.atlassian.net/browse/CLDR-18446&#34;&gt;CLDR JIRA ticket for digits&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;call-to-action&#34;&gt;Call to Action&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;re making an i18n library, thank you so much. It&amp;rsquo;s one of the things that requires effort of many people and curation from someone with a lot of patience. Some of the things that can be automated like numbers and dates formatting is done in CLDR and I suggest that you use this data, unless you already do. If there is a conflicting data, please resolve the conflicts and contribute to CLDR.&lt;/p&gt;
&lt;p&gt;If you use a library that can format money, please check that it does that based on locales, and please check that Serbian formatting is fine. If it&amp;rsquo;s not, please complain in their github, and maybe it means that they don&amp;rsquo;t use CLDR and you could complain about that as well.&lt;/p&gt;
&lt;p&gt;Finally, if you live in a small country or speak a less popular language, go check if CLDR is correct about it.&lt;/p&gt;
&lt;p&gt;Thanks everyone.&lt;/p&gt;
&lt;p&gt;Sources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/unicode-org/cldr-json&#34;&gt;Unicode CLDR&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://english.stackexchange.com/questions/388543/are-spelling-punctuation-and-capitalization-part-of-grammar&#34;&gt;Spelling and punctuation are not part of grammar&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://gist.github.com/rgs/6509585&#34;&gt;Falsehoods programmers believe about prices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Locale_%28computer_software%29&#34;&gt;Wikipedia about locales&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/unicode-org/cldr-json/blob/main/cldr-json/cldr-core/availableLocales.json&#34;&gt;The list of locales&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://402.ecma-international.org/11.0/index.html#scope&#34;&gt;ECMA 402&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://kakosepise.net/srpski-jezik/pravopis/brojevi/&#34;&gt;How to format numbers in Serbian&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=43601224&#34;&gt;This post on hackernews&lt;/a&gt;&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Cross-Site Requests</title>
      <link>https://smagin.fyi/posts/cross-site-requests/</link>
      <pubDate>Sat, 01 Mar 2025 14:17:13 +0100</pubDate>
      <guid>https://smagin.fyi/posts/cross-site-requests/</guid>
      <description>&lt;p&gt;Hello, Internet. I thought about cross-site requests and realised we have both CSRF protection and CORS and it doesn&amp;rsquo;t make sense from the first glance. It does generally, but I need a thousand words to make it so.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CSRF&lt;/strong&gt; stands for Cross-Site Request Forgery. It was rather popular in the earlier internet but now it&amp;rsquo;s almost a non-issue thanks to standard prevention mechanisms built into most of popular web frameworks. The forgery is to make user click on a form that will send a cross-site request. The protection is to check that the request didn&amp;rsquo;t come from a third-party site.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CORS&lt;/strong&gt; stands for Cross-Origin Resource Sharing. It&amp;rsquo;s a part of HTTP specification that describes how to permit certain cross-site requests. This includes preflight requests and response headers that state which origins are allowed to send requests.&lt;/p&gt;
&lt;p&gt;So, by default, are cross-origin requests allowed and we need CSRF protection, or they are forbidden and we need CORS to allow them? The answer is both.&lt;/p&gt;
&lt;h3 id=&#34;the-default-behaviour&#34;&gt;The default behaviour&lt;/h3&gt;
&lt;p&gt;The default behaviour is defined by Same-origin policy, and is enforced by browsers. The policy states that, generally speaking, cross-site &lt;strong&gt;writes are allowed&lt;/strong&gt;, and cross-site &lt;strong&gt;reads are not&lt;/strong&gt;. You can send a POST request by submitting a form, you browser won&amp;rsquo;t let you read the response of it.&lt;/p&gt;
&lt;p&gt;There is a newer part of this spec that sort of solves CSRF. In 2019, there was an initiative to change default cookies behaviour. Before that, cookies were always sent in cross-site requests. The default was changed to not send cookies in cross-site POST requests. To do that, a new &lt;code&gt;SameSite&lt;/code&gt; attribute for the set-cookie header was introduced. The attribute value to make the old default is &lt;code&gt;None&lt;/code&gt;, and the new default would be &lt;code&gt;Lax&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In 2025, &lt;a href=&#34;https://caniuse.com/mdn-http_headers_set-cookie_samesite_lax_default&#34;&gt;96% browsers&lt;/a&gt; support the &lt;code&gt;SameSite&lt;/code&gt; attribute, and &lt;a href=&#34;https://caniuse.com/same-site-cookie-attribute&#34;&gt;75%&lt;/a&gt; support the new default. Notably, Safari haven&amp;rsquo;t adopted the default, and UCBrowser doesn&amp;rsquo;t support any nice things.&lt;/p&gt;
&lt;p&gt;Sidenote: I can&amp;rsquo;t understand how UCBrowser remains relatively popular among users, given that there are settings in js builders to build for N% of the users and next to nobody puts 99% there.&lt;/p&gt;
&lt;p&gt;Sidenote 2: Origin is not the same as Site. Origin is a combination of a scheme, a hostname, and a port. Site is a combination of scheme and &lt;em&gt;effective top level domain&lt;/em&gt; + 1. Subdomains and ports don&amp;rsquo;t matter for sites.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt; &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy&#34;&gt;Same-origin policy&lt;/a&gt; |
&lt;a href=&#34;https://caniuse.com/?search=samesite&#34;&gt;caniuse SameSite cookie attribute&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;cors&#34;&gt;CORS&lt;/h3&gt;
&lt;p&gt;CORS is a way to override the same origin policy per origin.&lt;/p&gt;
&lt;p&gt;The spec describes a certain browser-server interaction. Browser sends &lt;em&gt;preflight&lt;/em&gt; requests of type &lt;code&gt;OPTIONS&lt;/code&gt; before actual requests, server replies with rules for the origin. The rules are in a form of response headers. The rules may specify if the reply can be read, if headers can be sent and received, allowed HTTP methods. Header names start with &lt;code&gt;Access-Control&lt;/code&gt;. Browser then follows the rules.&lt;/p&gt;
&lt;p&gt;CORS applies for several types of the requests:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;js-initiated &lt;code&gt;fetch&lt;/code&gt; and &lt;code&gt;XMLHttpRequest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;web fonts&lt;/li&gt;
&lt;li&gt;webgl textures&lt;/li&gt;
&lt;li&gt;images/video frames drawn to a canvas using &lt;code&gt;drawImage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;css shapes from images&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What is notoriously not in this list is form submissions, otherwise known as simple requests. This is part of the internet being backward-compatible:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The motivation is that the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element from HTML 4.0 (which predates cross-site fetch() and XMLHttpRequest) can submit simple requests to any origin, so anyone writing a server must already be protecting against cross-site request forgery (CSRF). Under this assumption, the server doesn&amp;rsquo;t have to opt-in (by responding to a preflight request) to receive any request that looks like a form submission, since the threat of CSRF is no worse than that of form submission. However, the server still must opt-in using Access-Control-Allow-Origin to share the response with the script.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS&#34;&gt;the CORS page on MDN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question to readers:&lt;/strong&gt; How is that in line with the &lt;code&gt;SameSite&lt;/code&gt; initiative?&lt;/p&gt;
&lt;h3 id=&#34;csrf-protection&#34;&gt;CSRF protection&lt;/h3&gt;
&lt;p&gt;So, cross-site write requests are allowed, but responses won&amp;rsquo;t be shared. At the same time, as website developers, we mostly don&amp;rsquo;t want to allow that.&lt;/p&gt;
&lt;p&gt;The standard protection is to include into a write request a user-specific token available only on read:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;for forms this token is put into a hidden input,&lt;/li&gt;
&lt;li&gt;for js-initiated requests the token can be stored in a cookie or in a meta tag, and is put into params or request headers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;JS-initiated requests are not allowed cross-site by default anyway, but they &lt;em&gt;are&lt;/em&gt; allowed same-site. Adding a csrf token into js requests lets us do the check the same way for all the requests.&lt;/p&gt;
&lt;p&gt;This way we still depend on browser in a way that it still has to prevent responses to be read cross-site by default, but a bit less than if we were also reading something like &lt;code&gt;Origin&lt;/code&gt; request header instead of checking for the token.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 10.01.2026:&lt;/strong&gt; &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site&#34;&gt;Sec-Fetch-Site request header&lt;/a&gt; is widely available and even &lt;a href=&#34;https://github.com/rails/rails/pull/56350&#34;&gt;will be used&lt;/a&gt; in (at least) the next Ruby on Rails as the new default protection instead of a token.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question to readers:&lt;/strong&gt; In some of the frameworks CSRF tokens are rotated. Why?&lt;/p&gt;
&lt;h3 id=&#34;browser-is-important&#34;&gt;Browser is important&lt;/h3&gt;
&lt;p&gt;I want to emphasise how important browsers are in this whole security scheme. All the client state for all the sites is stored in browser, and it decides which parts to expose and when. It&amp;rsquo;s browsers that enforce Same-origin policy, it&amp;rsquo;s browsers that don&amp;rsquo;t let read responses if it&amp;rsquo;s not allowed by server. It&amp;rsquo;s browsers that decide if they adopt the new &lt;code&gt;SameSite=Lax&lt;/code&gt; default. It&amp;rsquo;s browsers that implement CORS and send safe preflight requests before actual PATCH or DELETE.&lt;/p&gt;
&lt;p&gt;We really have to trust browsers that we use.&lt;/p&gt;
&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;What I learned&#34; src=&#34; /pics/cross-site-requests.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The internet will become more secure and maybe a bit less backward-compatible when the &lt;code&gt;SameSite=Lax&lt;/code&gt; default will be adopted by 100% of the browsers. Until then, we will have to live with the situation where simple POST requests are special and allowed cross-site, while others fall into the CORS bucket.&lt;/p&gt;
&lt;p&gt;Thanks Nikita Skazki for reviewing this post more times than I care to admit.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=43231411&#34;&gt;This post on Hackernews&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;sources&#34;&gt;Sources&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy&#34;&gt;Same-origin policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://caniuse.com/?search=samesite&#34;&gt;caniuse SameSite cookie attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html&#34;&gt;OWASP CSRF cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.w3.org/wiki/CORS&#34;&gt;CORS wiki with requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.w3.org/TR/2020/SPSD-cors-20200602/&#34;&gt;CORS spec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS&#34;&gt;CORS on MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request&#34;&gt;Preflight request&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin&#34;&gt;Origin request header&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://web.dev/articles/same-site-same-origin&#34;&gt;Origin and Site&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</description>
      <content:encoded>&lt;p&gt;Hello, Internet. I thought about cross-site requests and realised we have both CSRF protection and CORS and it doesn&amp;rsquo;t make sense from the first glance. It does generally, but I need a thousand words to make it so.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CSRF&lt;/strong&gt; stands for Cross-Site Request Forgery. It was rather popular in the earlier internet but now it&amp;rsquo;s almost a non-issue thanks to standard prevention mechanisms built into most of popular web frameworks. The forgery is to make user click on a form that will send a cross-site request. The protection is to check that the request didn&amp;rsquo;t come from a third-party site.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CORS&lt;/strong&gt; stands for Cross-Origin Resource Sharing. It&amp;rsquo;s a part of HTTP specification that describes how to permit certain cross-site requests. This includes preflight requests and response headers that state which origins are allowed to send requests.&lt;/p&gt;
&lt;p&gt;So, by default, are cross-origin requests allowed and we need CSRF protection, or they are forbidden and we need CORS to allow them? The answer is both.&lt;/p&gt;
&lt;h3 id=&#34;the-default-behaviour&#34;&gt;The default behaviour&lt;/h3&gt;
&lt;p&gt;The default behaviour is defined by Same-origin policy, and is enforced by browsers. The policy states that, generally speaking, cross-site &lt;strong&gt;writes are allowed&lt;/strong&gt;, and cross-site &lt;strong&gt;reads are not&lt;/strong&gt;. You can send a POST request by submitting a form, you browser won&amp;rsquo;t let you read the response of it.&lt;/p&gt;
&lt;p&gt;There is a newer part of this spec that sort of solves CSRF. In 2019, there was an initiative to change default cookies behaviour. Before that, cookies were always sent in cross-site requests. The default was changed to not send cookies in cross-site POST requests. To do that, a new &lt;code&gt;SameSite&lt;/code&gt; attribute for the set-cookie header was introduced. The attribute value to make the old default is &lt;code&gt;None&lt;/code&gt;, and the new default would be &lt;code&gt;Lax&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In 2025, &lt;a href=&#34;https://caniuse.com/mdn-http_headers_set-cookie_samesite_lax_default&#34;&gt;96% browsers&lt;/a&gt; support the &lt;code&gt;SameSite&lt;/code&gt; attribute, and &lt;a href=&#34;https://caniuse.com/same-site-cookie-attribute&#34;&gt;75%&lt;/a&gt; support the new default. Notably, Safari haven&amp;rsquo;t adopted the default, and UCBrowser doesn&amp;rsquo;t support any nice things.&lt;/p&gt;
&lt;p&gt;Sidenote: I can&amp;rsquo;t understand how UCBrowser remains relatively popular among users, given that there are settings in js builders to build for N% of the users and next to nobody puts 99% there.&lt;/p&gt;
&lt;p&gt;Sidenote 2: Origin is not the same as Site. Origin is a combination of a scheme, a hostname, and a port. Site is a combination of scheme and &lt;em&gt;effective top level domain&lt;/em&gt; + 1. Subdomains and ports don&amp;rsquo;t matter for sites.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt; &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy&#34;&gt;Same-origin policy&lt;/a&gt; |
&lt;a href=&#34;https://caniuse.com/?search=samesite&#34;&gt;caniuse SameSite cookie attribute&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;cors&#34;&gt;CORS&lt;/h3&gt;
&lt;p&gt;CORS is a way to override the same origin policy per origin.&lt;/p&gt;
&lt;p&gt;The spec describes a certain browser-server interaction. Browser sends &lt;em&gt;preflight&lt;/em&gt; requests of type &lt;code&gt;OPTIONS&lt;/code&gt; before actual requests, server replies with rules for the origin. The rules are in a form of response headers. The rules may specify if the reply can be read, if headers can be sent and received, allowed HTTP methods. Header names start with &lt;code&gt;Access-Control&lt;/code&gt;. Browser then follows the rules.&lt;/p&gt;
&lt;p&gt;CORS applies for several types of the requests:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;js-initiated &lt;code&gt;fetch&lt;/code&gt; and &lt;code&gt;XMLHttpRequest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;web fonts&lt;/li&gt;
&lt;li&gt;webgl textures&lt;/li&gt;
&lt;li&gt;images/video frames drawn to a canvas using &lt;code&gt;drawImage&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;css shapes from images&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What is notoriously not in this list is form submissions, otherwise known as simple requests. This is part of the internet being backward-compatible:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The motivation is that the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element from HTML 4.0 (which predates cross-site fetch() and XMLHttpRequest) can submit simple requests to any origin, so anyone writing a server must already be protecting against cross-site request forgery (CSRF). Under this assumption, the server doesn&amp;rsquo;t have to opt-in (by responding to a preflight request) to receive any request that looks like a form submission, since the threat of CSRF is no worse than that of form submission. However, the server still must opt-in using Access-Control-Allow-Origin to share the response with the script.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;From &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS&#34;&gt;the CORS page on MDN&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question to readers:&lt;/strong&gt; How is that in line with the &lt;code&gt;SameSite&lt;/code&gt; initiative?&lt;/p&gt;
&lt;h3 id=&#34;csrf-protection&#34;&gt;CSRF protection&lt;/h3&gt;
&lt;p&gt;So, cross-site write requests are allowed, but responses won&amp;rsquo;t be shared. At the same time, as website developers, we mostly don&amp;rsquo;t want to allow that.&lt;/p&gt;
&lt;p&gt;The standard protection is to include into a write request a user-specific token available only on read:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;for forms this token is put into a hidden input,&lt;/li&gt;
&lt;li&gt;for js-initiated requests the token can be stored in a cookie or in a meta tag, and is put into params or request headers.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;JS-initiated requests are not allowed cross-site by default anyway, but they &lt;em&gt;are&lt;/em&gt; allowed same-site. Adding a csrf token into js requests lets us do the check the same way for all the requests.&lt;/p&gt;
&lt;p&gt;This way we still depend on browser in a way that it still has to prevent responses to be read cross-site by default, but a bit less than if we were also reading something like &lt;code&gt;Origin&lt;/code&gt; request header instead of checking for the token.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 10.01.2026:&lt;/strong&gt; &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site&#34;&gt;Sec-Fetch-Site request header&lt;/a&gt; is widely available and even &lt;a href=&#34;https://github.com/rails/rails/pull/56350&#34;&gt;will be used&lt;/a&gt; in (at least) the next Ruby on Rails as the new default protection instead of a token.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Question to readers:&lt;/strong&gt; In some of the frameworks CSRF tokens are rotated. Why?&lt;/p&gt;
&lt;h3 id=&#34;browser-is-important&#34;&gt;Browser is important&lt;/h3&gt;
&lt;p&gt;I want to emphasise how important browsers are in this whole security scheme. All the client state for all the sites is stored in browser, and it decides which parts to expose and when. It&amp;rsquo;s browsers that enforce Same-origin policy, it&amp;rsquo;s browsers that don&amp;rsquo;t let read responses if it&amp;rsquo;s not allowed by server. It&amp;rsquo;s browsers that decide if they adopt the new &lt;code&gt;SameSite=Lax&lt;/code&gt; default. It&amp;rsquo;s browsers that implement CORS and send safe preflight requests before actual PATCH or DELETE.&lt;/p&gt;
&lt;p&gt;We really have to trust browsers that we use.&lt;/p&gt;
&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;What I learned&#34; src=&#34; /pics/cross-site-requests.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The internet will become more secure and maybe a bit less backward-compatible when the &lt;code&gt;SameSite=Lax&lt;/code&gt; default will be adopted by 100% of the browsers. Until then, we will have to live with the situation where simple POST requests are special and allowed cross-site, while others fall into the CORS bucket.&lt;/p&gt;
&lt;p&gt;Thanks Nikita Skazki for reviewing this post more times than I care to admit.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://news.ycombinator.com/item?id=43231411&#34;&gt;This post on Hackernews&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&#34;sources&#34;&gt;Sources&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy&#34;&gt;Same-origin policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://caniuse.com/?search=samesite&#34;&gt;caniuse SameSite cookie attribute&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html&#34;&gt;OWASP CSRF cheatsheet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.w3.org/wiki/CORS&#34;&gt;CORS wiki with requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.w3.org/TR/2020/SPSD-cors-20200602/&#34;&gt;CORS spec&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS&#34;&gt;CORS on MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request&#34;&gt;Preflight request&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin&#34;&gt;Origin request header&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://web.dev/articles/same-site-same-origin&#34;&gt;Origin and Site&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
</content:encoded>
    </item>
    <item>
      <title>I had questions about CSRF</title>
      <link>https://smagin.fyi/posts/csrf/</link>
      <pubDate>Sun, 09 Feb 2025 15:19:51 +0100</pubDate>
      <guid>https://smagin.fyi/posts/csrf/</guid>
      <description>&lt;p&gt;&lt;abbr&gt;CSRF&lt;/abbr&gt; stands for Cross-Site Request Forgery. It was rather popular in the earlier internet but now it&amp;rsquo;s almost a non-issue thanks to standard prevention mechanisms built into most of popular web frameworks. So I knew about it but never thought too much and assumed it just works. It does, but understanding why it does required me to R more than one FM.&lt;/p&gt;
&lt;p&gt;According to &lt;a href=&#34;https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html&#34;&gt;&lt;abbr&gt;OWASP&lt;/abbr&gt;&lt;/a&gt;,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A Cross-Site Request Forgery (CSRF) attack occurs when a malicious web site, email, blog, instant message, or program tricks an authenticated user&amp;rsquo;s web browser into performing an unwanted action on a trusted site. [&amp;hellip;] unprotected target sites cannot distinguish between legitimate authorized requests and forged authenticated requests.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Since browser requests automatically include all cookies including session cookies, this attack works unless proper authorization is used, which means that the target site&amp;rsquo;s challenge-response mechanism does not verify the identity and authority of the requester. In effect, CSRF attacks make a target system perform attacker-specified functions via the victim&amp;rsquo;s browser without the victim&amp;rsquo;s knowledge (normally until after the unauthorized actions have been committed).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;However, successful CSRF attacks can only exploit the capabilities exposed by the vulnerable application and the user&amp;rsquo;s privileges. Depending on the user&amp;rsquo;s credentials, the attacker can transfer funds, change a password, make an unauthorized purchase, elevate privileges for a target account, or take any action that the user is permitted to do.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Preventing &lt;abbr&gt;CSRF&lt;/abbr&gt; means making sure the request is not cross-site, i.e. the request origin is the same as the target, i.e you were on the same site you are sending the request to.&lt;/p&gt;
&lt;p&gt;Like all the things making sure, it requires a secret token that is associated with user. If we send forms without javascript involved, the token can be put into a form as a hidden input. Otherwise, the key is typically put into a &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tag, or a cookie, and then some javascript gets it from there and puts into requests.&lt;/p&gt;
&lt;h6 id=&#34;a-cookie&#34;&gt;A cookie?&lt;/h6&gt;
&lt;p&gt;Cookies are set for a specific domain or a domain with its&amp;rsquo; subdomains. There is a &lt;code&gt;Domain&lt;/code&gt; attribute for the &lt;code&gt;Set-Cookie&lt;/code&gt; header, and not setting it is the strictest option possible. There are &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie&#34;&gt;other attributes&lt;/a&gt; and prefixes that ensure other things. Rather ironically, &lt;code&gt;Secure&lt;/code&gt; only means that the request to set cookie was sent using https.&lt;/p&gt;
&lt;p&gt;Other notable attributes are &lt;code&gt;SameSite&lt;/code&gt; and &lt;code&gt;HttpOnly&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So if you put a CSRF token into a cookie, it can only be read from the same domain and you are safe, unless there are subdomains that you don&amp;rsquo;t control. It shouldn&amp;rsquo;t be &lt;code&gt;HttpOnly&lt;/code&gt; if you want to read it from JS.&lt;/p&gt;
&lt;h6 id=&#34;do-i-have-to-read-it-from-js&#34;&gt;Do I have to read it from JS?&lt;/h6&gt;
&lt;p&gt;In the beginning on 2025, yes, sadly.&lt;/p&gt;
&lt;p&gt;There is &lt;code&gt;SameSite&lt;/code&gt; attribue for the set-cookie header that may change it in the future. This attribute is about whether the cookie should be included into a request depending on the origin. The default value is &lt;code&gt;Lax&lt;/code&gt;, and it demands the browser to send the cookie for the same-site requests, and for the &amp;ldquo;safe&amp;rdquo; cross-origin requests. The latter means GET requests from other websites. &lt;code&gt;Strict&lt;/code&gt; doesn&amp;rsquo;t put the cookie into any cross-origin requests.&lt;/p&gt;
&lt;p&gt;In theory, this allows to not use the special token at all and only authorise user with a session cookie. The catch is it&amp;rsquo;s a rather new thing and not all the browsers support that. &lt;a href=&#34;https://caniuse.com/same-site-cookie-attribute&#34;&gt;96% do&lt;/a&gt;, but it&amp;rsquo;s not that we want the other 4% be vulnerable to that.&lt;/p&gt;
&lt;h6 id=&#34;why-do-we-need-another-token-cant-we-use-session-cookie-for-that&#34;&gt;Why do we need another token? Can&amp;rsquo;t we use session cookie for that?&lt;/h6&gt;
&lt;p&gt;Session cookie, or session identifier cookie, should be set with &lt;code&gt;HttpOnly&lt;/code&gt; attribute. This would prevent it from being read in javascript and give us a bit of Swiss cheese security. In case of a successful cross-site scripting attack your CSRF token will be compromised but the session won&amp;rsquo;t. In case of XSS you are in a pretty big trouble anyway, but when the vulnerability is fixed, CSRF tokens can be rotated, which is less of a nuisanse than logging everyone out.&lt;/p&gt;
&lt;h6 id=&#34;what-prevents-a-cookie-to-be-read-or-written-against-the-rules&#34;&gt;What prevents a cookie to be read or written against the rules?&lt;/h6&gt;
&lt;p&gt;Browsers. We expect browsers to comply with so many things. It won&amp;rsquo;t allow to read cookies for the wrong domain, it won&amp;rsquo;t allow to read &lt;code&gt;HttpOnly&lt;/code&gt; cookies in javascript, it won&amp;rsquo;t send a cookie into a cross-site request if &lt;code&gt;SameSite&lt;/code&gt; forbids that. Browsers also update automatically these days, but some people still use Opera mini from 2015 and UCBrowser that doesn&amp;rsquo;t support anything which prevents us all from having nice things.&lt;/p&gt;
&lt;h6 id=&#34;can-i-send-a-get-request-from-another-domain&#34;&gt;Can I send a GET request from another domain?&lt;/h6&gt;
&lt;p&gt;Yes, but you won&amp;rsquo;t get a response. Browsers also comply with the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#cross-origin_network_access&#34;&gt;Same-origin policy&lt;/a&gt;. In this policy, writes are typically allowed, and reads typically aren&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;As a site developer, you can control this. There is &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin&#34;&gt;Access-Control-Allow-Origin&lt;/a&gt; response header for that, it tells browser only to show the response to the allowed origins. For example, you can allow any origin by setting it to &lt;code&gt;*&lt;/code&gt;. This is useful if you are a CDN, but you really shouldn&amp;rsquo;t do that if you send an anti-CSRF token in the response.&lt;/p&gt;
&lt;p&gt;Also, the good part of write requests need a &lt;em&gt;preflight&lt;/em&gt; request first. Before sending a POST, browser sends an OPTIONS request, get the access control headers and decides if it&amp;rsquo;s even allowed.&lt;/p&gt;
&lt;p&gt;Why not all of the write requests have a preflight? Because the internet standards are backward-compatible more than most, and the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element existed before preflight requests were introduced. There is even a suggestion to make your server disallow simple requests altogether. This would mean that form submit won&amp;rsquo;t work, but you also won&amp;rsquo;t have to use tokens because every request is pre-flighted now.&lt;/p&gt;
&lt;p&gt;The whole part of the HTTP spec about selectively allowing cross-site requests is called CORS, which stands for Cross-Origin Resource Sharing. Naming is hard.&lt;/p&gt;
&lt;p&gt;BTW, remember we said that headers for another domain can&amp;rsquo;t be read from JS? They can&amp;rsquo;t, but you can allow to send them in a cross-site request. The preflight response header for that would be &lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt;.&lt;/p&gt;
&lt;h6 id=&#34;cant-server-just-check-request-origin&#34;&gt;Can&amp;rsquo;t server just check request origin?&lt;/h6&gt;
&lt;p&gt;Origin is another header, and it belongs to the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name&#34;&gt;Fobidden Headers List&lt;/a&gt;. Those are headers that can&amp;rsquo;t be set programmatically, only browser sets them.&lt;/p&gt;
&lt;p&gt;It &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin&#34;&gt;seems&lt;/a&gt; that &lt;code&gt;Origin&lt;/code&gt; header is always set in https cross-origin requests. It&amp;rsquo;s also set in many other cases but this is mostly what we check for. Browser may trim &lt;code&gt;Origin&lt;/code&gt; headers if a request goes through redirect, but redirect can&amp;rsquo;t be POST.&lt;/p&gt;
&lt;p&gt;The reason seems to be that this way we don&amp;rsquo;t have to trust browsers. &lt;abbr&gt;OWASP&lt;/abbr&gt; again:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Should a browser bug allow custom HTTP headers, or not enforce preflight on non-simple content types, it could compromise your security. Although unlikely, it is prudent to consider this in your threat model. Implementing CSRF tokens adds additional layer of defence and gives developers more control over security of the application.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What doesn&amp;rsquo;t add up for me is that we suddenly stop trusting browser for this case, but trust it on the Same-origin policy that prevents a malicious website from sending a GET request and reading the token from response. My guess is, it&amp;rsquo;s a complex system, and bugs can be subtle, so better be safe than sorry.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m also slightly suspicious about abusing origin information for user tracking. I&amp;rsquo;ve read about browsers sending less info in &lt;code&gt;Referer&lt;/code&gt; header for privacy reasons but haven&amp;rsquo;t found anything similar about &lt;code&gt;Origin&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Overall, I&amp;rsquo;d be grateful for a better answer for this question.&lt;/p&gt;
&lt;h6 id=&#34;why-do-we-rotate-csrf-tokens&#34;&gt;Why do we rotate CSRF tokens?&lt;/h6&gt;
&lt;p&gt;OWASP says&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Because the time range for an attacker to exploit the stolen tokens is minimal for per-request tokens, they are more secure than per-session tokens.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This doesn&amp;rsquo;t sound like a good reason to me. If a token is compromised you might as well think all the malicious requests are made the next second or two when user who did all the very suspicious actions required to give up the token clicks the last required button.&lt;/p&gt;
&lt;p&gt;This comes into the same bucket of why we rotate sessions. Google doesn&amp;rsquo;t even log me out but some sites do. I wonder what OWASP people think of that.&lt;/p&gt;
&lt;p&gt;Appreciate comments on this one as well.&lt;/p&gt;
&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;&lt;abbr&gt;CSRF&lt;/abbr&gt; prevention is putting into the request something that can only be read from the same origin. Write authorization based on read authorization, if you like.&lt;/p&gt;
&lt;p&gt;The future will be bright when 100% of browsers that people use will support &lt;code&gt;SameSite&lt;/code&gt; attribute. Until then, we have a rather complex but rather elegant system to prevent unwanted cross-site requests. And I still don&amp;rsquo;t fully understand what&amp;rsquo;s wrong with checking request origin.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;&lt;abbr&gt;CSRF&lt;/abbr&gt; stands for Cross-Site Request Forgery. It was rather popular in the earlier internet but now it&amp;rsquo;s almost a non-issue thanks to standard prevention mechanisms built into most of popular web frameworks. So I knew about it but never thought too much and assumed it just works. It does, but understanding why it does required me to R more than one FM.&lt;/p&gt;
&lt;p&gt;According to &lt;a href=&#34;https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html&#34;&gt;&lt;abbr&gt;OWASP&lt;/abbr&gt;&lt;/a&gt;,&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A Cross-Site Request Forgery (CSRF) attack occurs when a malicious web site, email, blog, instant message, or program tricks an authenticated user&amp;rsquo;s web browser into performing an unwanted action on a trusted site. [&amp;hellip;] unprotected target sites cannot distinguish between legitimate authorized requests and forged authenticated requests.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;Since browser requests automatically include all cookies including session cookies, this attack works unless proper authorization is used, which means that the target site&amp;rsquo;s challenge-response mechanism does not verify the identity and authority of the requester. In effect, CSRF attacks make a target system perform attacker-specified functions via the victim&amp;rsquo;s browser without the victim&amp;rsquo;s knowledge (normally until after the unauthorized actions have been committed).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;However, successful CSRF attacks can only exploit the capabilities exposed by the vulnerable application and the user&amp;rsquo;s privileges. Depending on the user&amp;rsquo;s credentials, the attacker can transfer funds, change a password, make an unauthorized purchase, elevate privileges for a target account, or take any action that the user is permitted to do.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Preventing &lt;abbr&gt;CSRF&lt;/abbr&gt; means making sure the request is not cross-site, i.e. the request origin is the same as the target, i.e you were on the same site you are sending the request to.&lt;/p&gt;
&lt;p&gt;Like all the things making sure, it requires a secret token that is associated with user. If we send forms without javascript involved, the token can be put into a form as a hidden input. Otherwise, the key is typically put into a &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tag, or a cookie, and then some javascript gets it from there and puts into requests.&lt;/p&gt;
&lt;h6 id=&#34;a-cookie&#34;&gt;A cookie?&lt;/h6&gt;
&lt;p&gt;Cookies are set for a specific domain or a domain with its&amp;rsquo; subdomains. There is a &lt;code&gt;Domain&lt;/code&gt; attribute for the &lt;code&gt;Set-Cookie&lt;/code&gt; header, and not setting it is the strictest option possible. There are &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie&#34;&gt;other attributes&lt;/a&gt; and prefixes that ensure other things. Rather ironically, &lt;code&gt;Secure&lt;/code&gt; only means that the request to set cookie was sent using https.&lt;/p&gt;
&lt;p&gt;Other notable attributes are &lt;code&gt;SameSite&lt;/code&gt; and &lt;code&gt;HttpOnly&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So if you put a CSRF token into a cookie, it can only be read from the same domain and you are safe, unless there are subdomains that you don&amp;rsquo;t control. It shouldn&amp;rsquo;t be &lt;code&gt;HttpOnly&lt;/code&gt; if you want to read it from JS.&lt;/p&gt;
&lt;h6 id=&#34;do-i-have-to-read-it-from-js&#34;&gt;Do I have to read it from JS?&lt;/h6&gt;
&lt;p&gt;In the beginning on 2025, yes, sadly.&lt;/p&gt;
&lt;p&gt;There is &lt;code&gt;SameSite&lt;/code&gt; attribue for the set-cookie header that may change it in the future. This attribute is about whether the cookie should be included into a request depending on the origin. The default value is &lt;code&gt;Lax&lt;/code&gt;, and it demands the browser to send the cookie for the same-site requests, and for the &amp;ldquo;safe&amp;rdquo; cross-origin requests. The latter means GET requests from other websites. &lt;code&gt;Strict&lt;/code&gt; doesn&amp;rsquo;t put the cookie into any cross-origin requests.&lt;/p&gt;
&lt;p&gt;In theory, this allows to not use the special token at all and only authorise user with a session cookie. The catch is it&amp;rsquo;s a rather new thing and not all the browsers support that. &lt;a href=&#34;https://caniuse.com/same-site-cookie-attribute&#34;&gt;96% do&lt;/a&gt;, but it&amp;rsquo;s not that we want the other 4% be vulnerable to that.&lt;/p&gt;
&lt;h6 id=&#34;why-do-we-need-another-token-cant-we-use-session-cookie-for-that&#34;&gt;Why do we need another token? Can&amp;rsquo;t we use session cookie for that?&lt;/h6&gt;
&lt;p&gt;Session cookie, or session identifier cookie, should be set with &lt;code&gt;HttpOnly&lt;/code&gt; attribute. This would prevent it from being read in javascript and give us a bit of Swiss cheese security. In case of a successful cross-site scripting attack your CSRF token will be compromised but the session won&amp;rsquo;t. In case of XSS you are in a pretty big trouble anyway, but when the vulnerability is fixed, CSRF tokens can be rotated, which is less of a nuisanse than logging everyone out.&lt;/p&gt;
&lt;h6 id=&#34;what-prevents-a-cookie-to-be-read-or-written-against-the-rules&#34;&gt;What prevents a cookie to be read or written against the rules?&lt;/h6&gt;
&lt;p&gt;Browsers. We expect browsers to comply with so many things. It won&amp;rsquo;t allow to read cookies for the wrong domain, it won&amp;rsquo;t allow to read &lt;code&gt;HttpOnly&lt;/code&gt; cookies in javascript, it won&amp;rsquo;t send a cookie into a cross-site request if &lt;code&gt;SameSite&lt;/code&gt; forbids that. Browsers also update automatically these days, but some people still use Opera mini from 2015 and UCBrowser that doesn&amp;rsquo;t support anything which prevents us all from having nice things.&lt;/p&gt;
&lt;h6 id=&#34;can-i-send-a-get-request-from-another-domain&#34;&gt;Can I send a GET request from another domain?&lt;/h6&gt;
&lt;p&gt;Yes, but you won&amp;rsquo;t get a response. Browsers also comply with the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy#cross-origin_network_access&#34;&gt;Same-origin policy&lt;/a&gt;. In this policy, writes are typically allowed, and reads typically aren&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;As a site developer, you can control this. There is &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin&#34;&gt;Access-Control-Allow-Origin&lt;/a&gt; response header for that, it tells browser only to show the response to the allowed origins. For example, you can allow any origin by setting it to &lt;code&gt;*&lt;/code&gt;. This is useful if you are a CDN, but you really shouldn&amp;rsquo;t do that if you send an anti-CSRF token in the response.&lt;/p&gt;
&lt;p&gt;Also, the good part of write requests need a &lt;em&gt;preflight&lt;/em&gt; request first. Before sending a POST, browser sends an OPTIONS request, get the access control headers and decides if it&amp;rsquo;s even allowed.&lt;/p&gt;
&lt;p&gt;Why not all of the write requests have a preflight? Because the internet standards are backward-compatible more than most, and the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element existed before preflight requests were introduced. There is even a suggestion to make your server disallow simple requests altogether. This would mean that form submit won&amp;rsquo;t work, but you also won&amp;rsquo;t have to use tokens because every request is pre-flighted now.&lt;/p&gt;
&lt;p&gt;The whole part of the HTTP spec about selectively allowing cross-site requests is called CORS, which stands for Cross-Origin Resource Sharing. Naming is hard.&lt;/p&gt;
&lt;p&gt;BTW, remember we said that headers for another domain can&amp;rsquo;t be read from JS? They can&amp;rsquo;t, but you can allow to send them in a cross-site request. The preflight response header for that would be &lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt;.&lt;/p&gt;
&lt;h6 id=&#34;cant-server-just-check-request-origin&#34;&gt;Can&amp;rsquo;t server just check request origin?&lt;/h6&gt;
&lt;p&gt;Origin is another header, and it belongs to the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name&#34;&gt;Fobidden Headers List&lt;/a&gt;. Those are headers that can&amp;rsquo;t be set programmatically, only browser sets them.&lt;/p&gt;
&lt;p&gt;It &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin&#34;&gt;seems&lt;/a&gt; that &lt;code&gt;Origin&lt;/code&gt; header is always set in https cross-origin requests. It&amp;rsquo;s also set in many other cases but this is mostly what we check for. Browser may trim &lt;code&gt;Origin&lt;/code&gt; headers if a request goes through redirect, but redirect can&amp;rsquo;t be POST.&lt;/p&gt;
&lt;p&gt;The reason seems to be that this way we don&amp;rsquo;t have to trust browsers. &lt;abbr&gt;OWASP&lt;/abbr&gt; again:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Should a browser bug allow custom HTTP headers, or not enforce preflight on non-simple content types, it could compromise your security. Although unlikely, it is prudent to consider this in your threat model. Implementing CSRF tokens adds additional layer of defence and gives developers more control over security of the application.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What doesn&amp;rsquo;t add up for me is that we suddenly stop trusting browser for this case, but trust it on the Same-origin policy that prevents a malicious website from sending a GET request and reading the token from response. My guess is, it&amp;rsquo;s a complex system, and bugs can be subtle, so better be safe than sorry.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m also slightly suspicious about abusing origin information for user tracking. I&amp;rsquo;ve read about browsers sending less info in &lt;code&gt;Referer&lt;/code&gt; header for privacy reasons but haven&amp;rsquo;t found anything similar about &lt;code&gt;Origin&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Overall, I&amp;rsquo;d be grateful for a better answer for this question.&lt;/p&gt;
&lt;h6 id=&#34;why-do-we-rotate-csrf-tokens&#34;&gt;Why do we rotate CSRF tokens?&lt;/h6&gt;
&lt;p&gt;OWASP says&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Because the time range for an attacker to exploit the stolen tokens is minimal for per-request tokens, they are more secure than per-session tokens.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This doesn&amp;rsquo;t sound like a good reason to me. If a token is compromised you might as well think all the malicious requests are made the next second or two when user who did all the very suspicious actions required to give up the token clicks the last required button.&lt;/p&gt;
&lt;p&gt;This comes into the same bucket of why we rotate sessions. Google doesn&amp;rsquo;t even log me out but some sites do. I wonder what OWASP people think of that.&lt;/p&gt;
&lt;p&gt;Appreciate comments on this one as well.&lt;/p&gt;
&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;&lt;abbr&gt;CSRF&lt;/abbr&gt; prevention is putting into the request something that can only be read from the same origin. Write authorization based on read authorization, if you like.&lt;/p&gt;
&lt;p&gt;The future will be bright when 100% of browsers that people use will support &lt;code&gt;SameSite&lt;/code&gt; attribute. Until then, we have a rather complex but rather elegant system to prevent unwanted cross-site requests. And I still don&amp;rsquo;t fully understand what&amp;rsquo;s wrong with checking request origin.&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Ultranormal Signal</title>
      <link>https://smagin.fyi/posts/ultranormal-signal/</link>
      <pubDate>Thu, 02 Jan 2025 10:08:40 +0100</pubDate>
      <guid>https://smagin.fyi/posts/ultranormal-signal/</guid>
      <description>&lt;p&gt;&lt;strong&gt;UPD 25.04.2026:&lt;/strong&gt; Turns out this blow is about a widely known phenomenon, it&amp;rsquo;s just called &lt;a href=&#34;https://en.wikipedia.org/wiki/Supernormal_stimulus&#34;&gt;Supernormal Stimulus&lt;/a&gt; and I mistranslated it. Well, happens.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a concept I first &lt;a href=&#34;https://habr.com/ru/articles/370541/&#34;&gt;saw&lt;/a&gt; (in Russian) in relation to Anime and birds, which I&amp;rsquo;ve ended up using a lot in other contexts. The concept is that you can abuse pattern recognition of receivers of all sorts by giving them patterns you want them to recognise without actually sending the signal they are trying to recognise from that pattern, and receivers would react to them more intensely than to a real entity.&lt;/p&gt;
&lt;p&gt;This can be reified in art, in confidence tricks, in training immune system, and I&amp;rsquo;m sure in thousand other ways because it&amp;rsquo;s everywhere.&lt;/p&gt;
&lt;h3 id=&#34;pattern-recognition&#34;&gt;Pattern recognition&lt;/h3&gt;
&lt;p&gt;There is a chance you heard about pattern recognition mostly in context of neural networks, be it brains or artificial ones. Say you want it to recognise cats. You show it a number to cats, a number of non-cats, then show &lt;em&gt;something&lt;/em&gt; and it would decide if this something is a cat or not.&lt;/p&gt;
&lt;p&gt;Now, imagine you want to show that network something that is not a cat but would be perceived as a cat. For example, a photo of a cat. You could see videos where cats are shown images of other cats and they&amp;rsquo;d react to them like if they were real. Silly cats eh?&lt;/p&gt;
&lt;p&gt;Now, imagine that we want something that wouldn&amp;rsquo;t be a cat but would be perceived as cat-ty as real cats can&amp;rsquo;t be. That would be what I know as &lt;strong&gt;ultranormal signal&lt;/strong&gt;. I struggle to find a good example of that for cats because cat is many things, but if we want a cutest image of a cat perceived by a human, there is a good chance that a photo of a cat won&amp;rsquo;t be on top, an anime-style drawing will.&lt;/p&gt;
&lt;p&gt;Key things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ultranormal signal is a fake signal&lt;/li&gt;
&lt;li&gt;that mimics certain patterns and exagerates them beyond anything possible in reality,&lt;/li&gt;
&lt;li&gt;that leads to a stronger response from the receiver.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I see this concept everywhere.&lt;/p&gt;
&lt;h3 id=&#34;impressionism&#34;&gt;Impressionism&lt;/h3&gt;
&lt;p&gt;Impressionism is the first major movement of what is usually in the modern art sections of museums. This is over 150 years old now so the concept probably won&amp;rsquo;t be novel for most people in 2025.&lt;/p&gt;
&lt;p&gt;Before impressionism the goal of representational art was to draw things so they look as close to the reality as possible. This was a) perfected by then and b) largely unneeded because photo was invented.  The impressionists instead tried to represent the world as they felt it, as they perceived it, as the impression they had of it. And turns out, being visually accurate wasn&amp;rsquo;t the necessary part of it. There is a lot of technical detail (like you should draw it fast before it&amp;rsquo;s gone), and a lot of finding your own style in it, but it&amp;rsquo;s also something that makes people feel the same rainy city a lot more effective than looking at a photo of a rainy city.&lt;/p&gt;
&lt;p&gt;That said, impressionism is not the only genre like that, it&amp;rsquo;s just the first one.&lt;/p&gt;
&lt;p&gt;Before we go to the nasty examples, look at &lt;a href=&#34;https://x.com/sovietvisuals/status/1309084412546433024&#34;&gt;this tweet&lt;/a&gt; and &lt;a href=&#34;https://rekall.me/&#34;&gt;this website&lt;/a&gt;. The first one has so much in it: it&amp;rsquo;s a factory, and it&amp;rsquo;s huge and imperfect made of steel, and maybe unpleasant to be in. But it&amp;rsquo;s not alien, and there are people who built it, and people who go there, who see that bright future and are not afraid to use this disproportionally large tools to get to it.&lt;/p&gt;
&lt;p&gt;The second one is a collection of visuals that gives you the impression of something that never existed, a parallel universe where design went a different way, and everything is angular and brutal, and gloom despite all the neon. Where old tech is next to new and next to something that never existed or possible. All that retrowave.&lt;/p&gt;
&lt;p&gt;Alright.&lt;/p&gt;
&lt;h3 id=&#34;attention-economy&#34;&gt;Attention economy&lt;/h3&gt;
&lt;p&gt;Human attention is a scarce and a valuable resource. That fact perceived as an opportunity caused so much abuse.&lt;/p&gt;
&lt;p&gt;You can find rants about it across the internet about that but two things that people don&amp;rsquo;t like the most is news and social networks.&lt;/p&gt;
&lt;p&gt;News create and maintain a sense of being important by generating dozens of new articles daily. Things just don&amp;rsquo;t happen at that rate, or not to you, and most of those articles are reactions and followups and other fillers made to give you another notification. Another problem about news is that negative content &lt;a href=&#34;https://youtu.be/rE3j_RHkqJc&#34;&gt;catches&lt;/a&gt; attention better than the positive or informative one. This makes news literally an internet hate machine. That&amp;rsquo;s not the exhaustive list of problems with the news but that&amp;rsquo;s enough to categorise it as an ultranormal signal that wants to catch your attention.&lt;/p&gt;
&lt;p&gt;No wonder people who find their ways to stop reading news are &lt;a href=&#34;https://www.experimental-history.com/p/reading-the-news-is-the-new-smoking&#34;&gt;happy&lt;/a&gt; about it.&lt;/p&gt;
&lt;p&gt;Another notorious attention hijacker is social networks. They abuse the same mechanism, perhaps even more successfully. Sometimes successful enough to call the victims terminally online and asking those who are not terminally online yet to go and touch grass.&lt;/p&gt;
&lt;p&gt;Unfortunately, other apps can send you notifications too, unless you ban them from. And even if you disable notifications, applications are getting a habit to show you irrelevant stuff when you open them. No wonder though, that&amp;rsquo;s the time they have your attention.&lt;/p&gt;
&lt;h3 id=&#34;goodharts-law&#34;&gt;Goodhart&amp;rsquo;s law&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;When a measure becomes a target, it ceases to be a good measure&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This essentially says that people will try to produce ultranormal signals when they know the pattern. Go figure in your nearest measurable system what the measurement is and how the signals are produced. Goes from the amount of closed tasks to test coverage to preparing to exams by learning answers instead of principles to meeting whatever targets the companies have to literally everything.&lt;/p&gt;
&lt;p&gt;The most extreme case I&amp;rsquo;ve seen recently is &lt;a href=&#34;https://www.wheresyoured.at/the-men-who-killed-google/&#34;&gt;the man who killed google search&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cargo-cult&#34;&gt;Cargo cult&lt;/h3&gt;
&lt;p&gt;The term comes from something happened during WWII. People built airport-like structures and
were doing rituals that looked roughly like parades hoping that it would cause cargo planes
to arrive and bring food and other goods.&lt;/p&gt;
&lt;p&gt;Wikipedia says it&amp;rsquo;s more complex than that and people built a whole religion around that,
so let&amp;rsquo;s say I&amp;rsquo;m lying for clarity.&lt;/p&gt;
&lt;p&gt;The term stuck because people love doing things to achieve something other people did
without understanding why they did them in the first place and what is missing in the imitators
worldview. Business and programming are notorious about that, but I&amp;rsquo;m sure I&amp;rsquo;m saying that
because I&amp;rsquo;ve seen a thing or two in these two spheres and isn&amp;rsquo;t competent in other ones.&lt;/p&gt;
&lt;p&gt;Here goes the stretch. We can describe about any complex system as somethings that has
inputs and outputs and pretend the two are somewhat connected sometimes. Then cargo cult
is a failed attempt to find this connection and produce an ultranormal signal. The signal
is definitely fake, the intention to get a response is obvious, but the &lt;em&gt;ultra-&lt;/em&gt; part is debatable.&lt;/p&gt;
&lt;h3 id=&#34;greenwashing&#34;&gt;Greenwashing&lt;/h3&gt;
&lt;p&gt;Greenwashing is an attempt to make people think that the company is or on the way to be environmentally friendly without intending to go this way with the methods described. There is a name for that but the practice persists so it so I&amp;rsquo;d think of it as a semi-successful attempt in generating an ultranormal signal.&lt;/p&gt;
&lt;p&gt;This practice has particularly nasty tricks including plain lying, describing distant plans, doing thing that won&amp;rsquo;t help but will keep people busy, and shifting the blame to customers. Anyway.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s ultranormal about it is that the really environmental-friendly practices don&amp;rsquo;t usually get this much marketing effort, e.g. trams are much better than electric cars for the environment, yet go compare  media presence of the two.&lt;/p&gt;
&lt;h3 id=&#34;vaccines&#34;&gt;Vaccines&lt;/h3&gt;
&lt;p&gt;Vaccines are a way to show the immune system how a virus looks without infecting the organism, often causing a stronger and more focused immune response. Sounds ultranormal to me.&lt;/p&gt;
&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;I wrote this post to explain a term and to link the post when people don&amp;rsquo;t understand it. The term is&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ultranormal signal&lt;/strong&gt; is a fake signal that abuses the receiver&amp;rsquo;s pattern recognition ability by mimicking a pattern, exagerating it beyond real and causing a stronger response than anything real would.&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;&lt;strong&gt;UPD 25.04.2026:&lt;/strong&gt; Turns out this blow is about a widely known phenomenon, it&amp;rsquo;s just called &lt;a href=&#34;https://en.wikipedia.org/wiki/Supernormal_stimulus&#34;&gt;Supernormal Stimulus&lt;/a&gt; and I mistranslated it. Well, happens.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a concept I first &lt;a href=&#34;https://habr.com/ru/articles/370541/&#34;&gt;saw&lt;/a&gt; (in Russian) in relation to Anime and birds, which I&amp;rsquo;ve ended up using a lot in other contexts. The concept is that you can abuse pattern recognition of receivers of all sorts by giving them patterns you want them to recognise without actually sending the signal they are trying to recognise from that pattern, and receivers would react to them more intensely than to a real entity.&lt;/p&gt;
&lt;p&gt;This can be reified in art, in confidence tricks, in training immune system, and I&amp;rsquo;m sure in thousand other ways because it&amp;rsquo;s everywhere.&lt;/p&gt;
&lt;h3 id=&#34;pattern-recognition&#34;&gt;Pattern recognition&lt;/h3&gt;
&lt;p&gt;There is a chance you heard about pattern recognition mostly in context of neural networks, be it brains or artificial ones. Say you want it to recognise cats. You show it a number to cats, a number of non-cats, then show &lt;em&gt;something&lt;/em&gt; and it would decide if this something is a cat or not.&lt;/p&gt;
&lt;p&gt;Now, imagine you want to show that network something that is not a cat but would be perceived as a cat. For example, a photo of a cat. You could see videos where cats are shown images of other cats and they&amp;rsquo;d react to them like if they were real. Silly cats eh?&lt;/p&gt;
&lt;p&gt;Now, imagine that we want something that wouldn&amp;rsquo;t be a cat but would be perceived as cat-ty as real cats can&amp;rsquo;t be. That would be what I know as &lt;strong&gt;ultranormal signal&lt;/strong&gt;. I struggle to find a good example of that for cats because cat is many things, but if we want a cutest image of a cat perceived by a human, there is a good chance that a photo of a cat won&amp;rsquo;t be on top, an anime-style drawing will.&lt;/p&gt;
&lt;p&gt;Key things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ultranormal signal is a fake signal&lt;/li&gt;
&lt;li&gt;that mimics certain patterns and exagerates them beyond anything possible in reality,&lt;/li&gt;
&lt;li&gt;that leads to a stronger response from the receiver.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I see this concept everywhere.&lt;/p&gt;
&lt;h3 id=&#34;impressionism&#34;&gt;Impressionism&lt;/h3&gt;
&lt;p&gt;Impressionism is the first major movement of what is usually in the modern art sections of museums. This is over 150 years old now so the concept probably won&amp;rsquo;t be novel for most people in 2025.&lt;/p&gt;
&lt;p&gt;Before impressionism the goal of representational art was to draw things so they look as close to the reality as possible. This was a) perfected by then and b) largely unneeded because photo was invented.  The impressionists instead tried to represent the world as they felt it, as they perceived it, as the impression they had of it. And turns out, being visually accurate wasn&amp;rsquo;t the necessary part of it. There is a lot of technical detail (like you should draw it fast before it&amp;rsquo;s gone), and a lot of finding your own style in it, but it&amp;rsquo;s also something that makes people feel the same rainy city a lot more effective than looking at a photo of a rainy city.&lt;/p&gt;
&lt;p&gt;That said, impressionism is not the only genre like that, it&amp;rsquo;s just the first one.&lt;/p&gt;
&lt;p&gt;Before we go to the nasty examples, look at &lt;a href=&#34;https://x.com/sovietvisuals/status/1309084412546433024&#34;&gt;this tweet&lt;/a&gt; and &lt;a href=&#34;https://rekall.me/&#34;&gt;this website&lt;/a&gt;. The first one has so much in it: it&amp;rsquo;s a factory, and it&amp;rsquo;s huge and imperfect made of steel, and maybe unpleasant to be in. But it&amp;rsquo;s not alien, and there are people who built it, and people who go there, who see that bright future and are not afraid to use this disproportionally large tools to get to it.&lt;/p&gt;
&lt;p&gt;The second one is a collection of visuals that gives you the impression of something that never existed, a parallel universe where design went a different way, and everything is angular and brutal, and gloom despite all the neon. Where old tech is next to new and next to something that never existed or possible. All that retrowave.&lt;/p&gt;
&lt;p&gt;Alright.&lt;/p&gt;
&lt;h3 id=&#34;attention-economy&#34;&gt;Attention economy&lt;/h3&gt;
&lt;p&gt;Human attention is a scarce and a valuable resource. That fact perceived as an opportunity caused so much abuse.&lt;/p&gt;
&lt;p&gt;You can find rants about it across the internet about that but two things that people don&amp;rsquo;t like the most is news and social networks.&lt;/p&gt;
&lt;p&gt;News create and maintain a sense of being important by generating dozens of new articles daily. Things just don&amp;rsquo;t happen at that rate, or not to you, and most of those articles are reactions and followups and other fillers made to give you another notification. Another problem about news is that negative content &lt;a href=&#34;https://youtu.be/rE3j_RHkqJc&#34;&gt;catches&lt;/a&gt; attention better than the positive or informative one. This makes news literally an internet hate machine. That&amp;rsquo;s not the exhaustive list of problems with the news but that&amp;rsquo;s enough to categorise it as an ultranormal signal that wants to catch your attention.&lt;/p&gt;
&lt;p&gt;No wonder people who find their ways to stop reading news are &lt;a href=&#34;https://www.experimental-history.com/p/reading-the-news-is-the-new-smoking&#34;&gt;happy&lt;/a&gt; about it.&lt;/p&gt;
&lt;p&gt;Another notorious attention hijacker is social networks. They abuse the same mechanism, perhaps even more successfully. Sometimes successful enough to call the victims terminally online and asking those who are not terminally online yet to go and touch grass.&lt;/p&gt;
&lt;p&gt;Unfortunately, other apps can send you notifications too, unless you ban them from. And even if you disable notifications, applications are getting a habit to show you irrelevant stuff when you open them. No wonder though, that&amp;rsquo;s the time they have your attention.&lt;/p&gt;
&lt;h3 id=&#34;goodharts-law&#34;&gt;Goodhart&amp;rsquo;s law&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;When a measure becomes a target, it ceases to be a good measure&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This essentially says that people will try to produce ultranormal signals when they know the pattern. Go figure in your nearest measurable system what the measurement is and how the signals are produced. Goes from the amount of closed tasks to test coverage to preparing to exams by learning answers instead of principles to meeting whatever targets the companies have to literally everything.&lt;/p&gt;
&lt;p&gt;The most extreme case I&amp;rsquo;ve seen recently is &lt;a href=&#34;https://www.wheresyoured.at/the-men-who-killed-google/&#34;&gt;the man who killed google search&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cargo-cult&#34;&gt;Cargo cult&lt;/h3&gt;
&lt;p&gt;The term comes from something happened during WWII. People built airport-like structures and
were doing rituals that looked roughly like parades hoping that it would cause cargo planes
to arrive and bring food and other goods.&lt;/p&gt;
&lt;p&gt;Wikipedia says it&amp;rsquo;s more complex than that and people built a whole religion around that,
so let&amp;rsquo;s say I&amp;rsquo;m lying for clarity.&lt;/p&gt;
&lt;p&gt;The term stuck because people love doing things to achieve something other people did
without understanding why they did them in the first place and what is missing in the imitators
worldview. Business and programming are notorious about that, but I&amp;rsquo;m sure I&amp;rsquo;m saying that
because I&amp;rsquo;ve seen a thing or two in these two spheres and isn&amp;rsquo;t competent in other ones.&lt;/p&gt;
&lt;p&gt;Here goes the stretch. We can describe about any complex system as somethings that has
inputs and outputs and pretend the two are somewhat connected sometimes. Then cargo cult
is a failed attempt to find this connection and produce an ultranormal signal. The signal
is definitely fake, the intention to get a response is obvious, but the &lt;em&gt;ultra-&lt;/em&gt; part is debatable.&lt;/p&gt;
&lt;h3 id=&#34;greenwashing&#34;&gt;Greenwashing&lt;/h3&gt;
&lt;p&gt;Greenwashing is an attempt to make people think that the company is or on the way to be environmentally friendly without intending to go this way with the methods described. There is a name for that but the practice persists so it so I&amp;rsquo;d think of it as a semi-successful attempt in generating an ultranormal signal.&lt;/p&gt;
&lt;p&gt;This practice has particularly nasty tricks including plain lying, describing distant plans, doing thing that won&amp;rsquo;t help but will keep people busy, and shifting the blame to customers. Anyway.&lt;/p&gt;
&lt;p&gt;What&amp;rsquo;s ultranormal about it is that the really environmental-friendly practices don&amp;rsquo;t usually get this much marketing effort, e.g. trams are much better than electric cars for the environment, yet go compare  media presence of the two.&lt;/p&gt;
&lt;h3 id=&#34;vaccines&#34;&gt;Vaccines&lt;/h3&gt;
&lt;p&gt;Vaccines are a way to show the immune system how a virus looks without infecting the organism, often causing a stronger and more focused immune response. Sounds ultranormal to me.&lt;/p&gt;
&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;I wrote this post to explain a term and to link the post when people don&amp;rsquo;t understand it. The term is&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Ultranormal signal&lt;/strong&gt; is a fake signal that abuses the receiver&amp;rsquo;s pattern recognition ability by mimicking a pattern, exagerating it beyond real and causing a stronger response than anything real would.&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>dict-to-flashcard: Local-first spaced repetition with macOS Dictionary and Logseq</title>
      <link>https://smagin.fyi/posts/dict-to-flashcard/</link>
      <pubDate>Sun, 17 Nov 2024 19:08:27 +0100</pubDate>
      <guid>https://smagin.fyi/posts/dict-to-flashcard/</guid>
      <description>&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;I made a tiny alfred workflow that gets the word definition from macOS dictionary (with extra steps), converts it to logseq flashcard. This allows me to practice words I met while reading, on the phone too, offline too.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/s-mage/dict-to-flashcard&#34;&gt;repo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/s-mage/dict-to-flashcard/blob/main/card.alfredworkflow&#34;&gt;alfred workflow&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://x.com/s_mage/status/1838680176609173516&#34;&gt;twitter shitposting as I made this&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;I learn languages. At the time of writing, Serbian. This is not a very popular language,
so I can&amp;rsquo;t use Memrise or other spaced repetition apps to help me with words and phrases.&lt;/p&gt;
&lt;p&gt;I use Logseq to store my notes, and it has its own spaced repetition system called flashcards, which format is a no-brainer. I (and every mac computer) also have Apple Dictionary to look up words with dictionaries good enough and the app that works very nice as a dictionary.&lt;/p&gt;
&lt;p&gt;So I thought, let&amp;rsquo;s mate the two.&lt;/p&gt;
&lt;h2 id=&#34;extracting-definitions&#34;&gt;Extracting definitions&lt;/h2&gt;
&lt;p&gt;MacOS dictionary app works great. You can select dictionaries you want to use, order in which translations appear, and it updates as you type. It doesn&amp;rsquo;t need internet connection, and dictionaries quality is great. There is no Serbian dictionary, but there is a Croatian thesaurus and Croatian-English and back, which is good enough, at least for learning purposes.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;macos dictionary&#34; src=&#34; /pics/macos-dictionary.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;It also have no intention to give all these definitions to you in any form except showing them in the interface. No API, no shortcuts, no nothing.&lt;/p&gt;
&lt;p&gt;But if it doesn&amp;rsquo;t need internet, there has to be files. And those files can be found and parsed, right?&lt;/p&gt;
&lt;p&gt;Right, there are files. And I&amp;rsquo;m not the first person having this train of thoughts. And someone have done the parsing, and then someone else improved it and made into a python package called &lt;code&gt;apple-peeler&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The repo: &lt;a href=&#34;https://github.com/solarmist/apple-peeler&#34;&gt;apple-peeler&lt;/a&gt;. README has the references section that mentions a very enjoyable to read hackernews &lt;a href=&#34;https://news.ycombinator.com/item?id=28505406&#34;&gt;discussion&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After using this tool you&amp;rsquo;ll get a file per dictionary where every line is a definition in some xml, which the dictionary probably renders as is. To find a particular word I used &lt;code&gt;ripgrep&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-&amp;gt; rg &amp;#39;d:title=&amp;#34;odškrinuti&amp;#34;&amp;#39; ../apple-peeler-output/Croatian.xml --max-count=1 --no-line-number
&amp;lt;d:entry xmlns:d=&amp;#34;http://www.apple.com/DTDs/DictionaryService-1.0.rng&amp;#34; id=&amp;#34;59304&amp;#34; d:title=&amp;#34;odškrinuti&amp;#34; class=&amp;#34;entry&amp;#34; lang=&amp;#34;hr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;hg x_xh0&amp;#34;&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;hw&amp;#34;&amp;gt;odškrinuti &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.007&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;odškrínuti&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sg&amp;#34;&amp;gt;&amp;lt;span lexid=&amp;#34;m-hr0059298.002&amp;#34; class=&amp;#34;se1 x_xd0&amp;#34;&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;posg x_xdh&amp;#34;&amp;gt;&amp;lt;span d:pos=&amp;#34;1&amp;#34; class=&amp;#34;pos&amp;#34;&amp;gt;svrš. &amp;lt;d:pos&amp;gt;&amp;lt;/d:pos&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;infg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_infg&amp;#34;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sy&amp;#34;&amp;gt;prez. &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;inf&amp;#34;&amp;gt;odškrinem &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.008&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;òdškrīnēm&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; |&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp&amp;#34;&amp;gt;, &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sy&amp;#34;&amp;gt;pril. pr. &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;inf&amp;#34;&amp;gt;-uvši &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.009&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;-ūvši&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; |&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp&amp;#34;&amp;gt;, &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sy&amp;#34;&amp;gt;prid. trp. &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;inf&amp;#34;&amp;gt;odškrinut &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.010&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;òdškrīnūt&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; |&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_infg&amp;#34;&amp;gt;) &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;gg x_xd1&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_gg&amp;#34;&amp;gt;[&amp;lt;/span&amp;gt;što&amp;lt;span class=&amp;#34;gp tg_gg&amp;#34;&amp;gt;] &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span lexid=&amp;#34;m-hr0059298.004&amp;#34; class=&amp;#34;msDict x_xd1 t_core&amp;#34;&amp;gt;&amp;lt;span d:def=&amp;#34;1&amp;#34; role=&amp;#34;text&amp;#34; class=&amp;#34;df t_standard&amp;#34;&amp;gt;malo otvoriti, jedva malo rastvoriti&amp;lt;span class=&amp;#34;gp tg_df&amp;#34;&amp;gt;. &amp;lt;/span&amp;gt;&amp;lt;d:def&amp;gt;&amp;lt;/d:def&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;xrg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;xr&amp;#34;&amp;gt;pritvoriti&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_xrg&amp;#34;&amp;gt;: &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;eg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;ex&amp;#34;&amp;gt;odškrinuti vrata &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_eg&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;eg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;ex&amp;#34;&amp;gt;odškrinuti prozor&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_eg&amp;#34;&amp;gt;. &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/d:entry&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;making-sense-of-definitions-xml&#34;&gt;Making sense of definitions XML&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s the main part of the app, but also there is not much to tell about here. This was mostly trial and error process, and it&amp;rsquo;s not finished. But it&amp;rsquo;s good enough for my purposes.&lt;/p&gt;
&lt;p&gt;I have a text file with my findings but I don&amp;rsquo;t know if it&amp;rsquo;s any generic. For example, there are two types of definitions in the Croatian thesaurus, one is wrapped into nodes with classes &lt;code&gt;.se2.x_xd1.hasSn&lt;/code&gt;, and the other type has &lt;code&gt;.msDict.x_xd1.t_core&lt;/code&gt; classes. And there is a chance I haven&amp;rsquo;t met more types yet, for definitions or other things I try to extract.&lt;/p&gt;
&lt;p&gt;Speaking of, I managed to extract the word itself, transcription, definitions and phrases. More than enough for a flashcard.&lt;/p&gt;
&lt;p&gt;A way to find problematic words and new layouts would be to go through all the words in a dictionary and compare the text that the app extracts and the text that is there, and raise a flag if the two are very different by some metric, even by size. I might do this at some point, and pull requests are very welcome.&lt;/p&gt;
&lt;h2 id=&#34;formatting-it-as-a-flashcard&#34;&gt;Formatting it as a flashcard&lt;/h2&gt;
&lt;p&gt;Logseq has a very easy flashcard format. Two main concepts are marking blocks as cards using &lt;code&gt;#card&lt;/code&gt; and wrapping parts of it into &lt;code&gt;{{cloze ...}}&lt;/code&gt; so it hides them from you while you are trying to remember them. The parsing of it is not ideal (I think it gives up on parsing more than 3 clozes in a block and they don&amp;rsquo;t play nicely with some markdown formatting) but good enough.&lt;/p&gt;
&lt;p&gt;This is what I got:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;- ### {{cloze #{heading.text}}}
  {{cloze #{GENDERS[gender] || gender}#{inflections}}}

  Definitions

  #{definitions}#{definitions2}

  #{phrases.empty? ? &amp;#34;&amp;#34; : &amp;#34;Phrases\n\n  &amp;#34; + phrases}
  #card
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And this is what it looks like rendered:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;flashcard&#34; src=&#34; /pics/flashcard.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Cards in Logseq are just blocks. It means that it&amp;rsquo;s easy to modify them manually, and if the app formatted something incorrectly or I want to add my own note, I can just do that right when it&amp;rsquo;s shown to me. This proved extremely useful, I often add translations from the languages I know and sometimes synonims, phrases and associations have more use for me than the definition itself.&lt;/p&gt;
&lt;h2 id=&#34;wrapping-it-all-into-an-alfred-workflow&#34;&gt;Wrapping it all into an Alfred workflow&lt;/h2&gt;
&lt;p&gt;I use &lt;a href=&#34;https://www.alfredapp.com/&#34;&gt;Alfred&lt;/a&gt; to run things, be it an app, a file, or a helper. It&amp;rsquo;s really nice and allows to make your own workflows. So I made one. It takes the word, find the definition, puts it into logseq, and also opens the word in the dictionary app.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;alfred&#34; src=&#34; /pics/card-alfred-workflow.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;At the moment of writing I have 192 cards, and 8 to repeat now. Spaced repetition works ok, the whole thing is convenient and surprisingly doesn&amp;rsquo;t break every other word. Styles could be better but could be worse.&lt;/p&gt;
&lt;p&gt;It also checks local-first and works-on-mobile boxes, because logseq can sync its&amp;rsquo; files via icloud. I actually use both if I want to read offline, and to practice while on mobile.&lt;/p&gt;
&lt;p&gt;The video demo is in the &lt;a href=&#34;https://github.com/s-mage/dict-to-flashcard&#34;&gt;repo&lt;/a&gt;, go check it out.&lt;/p&gt;
</description>
      <content:encoded>&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;I made a tiny alfred workflow that gets the word definition from macOS dictionary (with extra steps), converts it to logseq flashcard. This allows me to practice words I met while reading, on the phone too, offline too.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/s-mage/dict-to-flashcard&#34;&gt;repo&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/s-mage/dict-to-flashcard/blob/main/card.alfredworkflow&#34;&gt;alfred workflow&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://x.com/s_mage/status/1838680176609173516&#34;&gt;twitter shitposting as I made this&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;I learn languages. At the time of writing, Serbian. This is not a very popular language,
so I can&amp;rsquo;t use Memrise or other spaced repetition apps to help me with words and phrases.&lt;/p&gt;
&lt;p&gt;I use Logseq to store my notes, and it has its own spaced repetition system called flashcards, which format is a no-brainer. I (and every mac computer) also have Apple Dictionary to look up words with dictionaries good enough and the app that works very nice as a dictionary.&lt;/p&gt;
&lt;p&gt;So I thought, let&amp;rsquo;s mate the two.&lt;/p&gt;
&lt;h2 id=&#34;extracting-definitions&#34;&gt;Extracting definitions&lt;/h2&gt;
&lt;p&gt;MacOS dictionary app works great. You can select dictionaries you want to use, order in which translations appear, and it updates as you type. It doesn&amp;rsquo;t need internet connection, and dictionaries quality is great. There is no Serbian dictionary, but there is a Croatian thesaurus and Croatian-English and back, which is good enough, at least for learning purposes.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;macos dictionary&#34; src=&#34; /pics/macos-dictionary.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;It also have no intention to give all these definitions to you in any form except showing them in the interface. No API, no shortcuts, no nothing.&lt;/p&gt;
&lt;p&gt;But if it doesn&amp;rsquo;t need internet, there has to be files. And those files can be found and parsed, right?&lt;/p&gt;
&lt;p&gt;Right, there are files. And I&amp;rsquo;m not the first person having this train of thoughts. And someone have done the parsing, and then someone else improved it and made into a python package called &lt;code&gt;apple-peeler&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The repo: &lt;a href=&#34;https://github.com/solarmist/apple-peeler&#34;&gt;apple-peeler&lt;/a&gt;. README has the references section that mentions a very enjoyable to read hackernews &lt;a href=&#34;https://news.ycombinator.com/item?id=28505406&#34;&gt;discussion&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;After using this tool you&amp;rsquo;ll get a file per dictionary where every line is a definition in some xml, which the dictionary probably renders as is. To find a particular word I used &lt;code&gt;ripgrep&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;-&amp;gt; rg &amp;#39;d:title=&amp;#34;odškrinuti&amp;#34;&amp;#39; ../apple-peeler-output/Croatian.xml --max-count=1 --no-line-number
&amp;lt;d:entry xmlns:d=&amp;#34;http://www.apple.com/DTDs/DictionaryService-1.0.rng&amp;#34; id=&amp;#34;59304&amp;#34; d:title=&amp;#34;odškrinuti&amp;#34; class=&amp;#34;entry&amp;#34; lang=&amp;#34;hr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;hg x_xh0&amp;#34;&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;hw&amp;#34;&amp;gt;odškrinuti &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.007&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;odškrínuti&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sg&amp;#34;&amp;gt;&amp;lt;span lexid=&amp;#34;m-hr0059298.002&amp;#34; class=&amp;#34;se1 x_xd0&amp;#34;&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;posg x_xdh&amp;#34;&amp;gt;&amp;lt;span d:pos=&amp;#34;1&amp;#34; class=&amp;#34;pos&amp;#34;&amp;gt;svrš. &amp;lt;d:pos&amp;gt;&amp;lt;/d:pos&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;infg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_infg&amp;#34;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sy&amp;#34;&amp;gt;prez. &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;inf&amp;#34;&amp;gt;odškrinem &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.008&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;òdškrīnēm&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; |&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp&amp;#34;&amp;gt;, &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sy&amp;#34;&amp;gt;pril. pr. &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;inf&amp;#34;&amp;gt;-uvši &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.009&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;-ūvši&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; |&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp&amp;#34;&amp;gt;, &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;sy&amp;#34;&amp;gt;prid. trp. &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;inf&amp;#34;&amp;gt;odškrinut &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;pr&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;span d:prn=&amp;#34;UK_IPA solitary&amp;#34; lexid=&amp;#34;m-hr0059298.010&amp;#34; class=&amp;#34;ph t_other&amp;#34;&amp;gt;òdškrīnūt&amp;lt;d:prn&amp;gt;&amp;lt;/d:prn&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_pr&amp;#34;&amp;gt; |&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_infg&amp;#34;&amp;gt;) &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;gg x_xd1&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;gp tg_gg&amp;#34;&amp;gt;[&amp;lt;/span&amp;gt;što&amp;lt;span class=&amp;#34;gp tg_gg&amp;#34;&amp;gt;] &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span lexid=&amp;#34;m-hr0059298.004&amp;#34; class=&amp;#34;msDict x_xd1 t_core&amp;#34;&amp;gt;&amp;lt;span d:def=&amp;#34;1&amp;#34; role=&amp;#34;text&amp;#34; class=&amp;#34;df t_standard&amp;#34;&amp;gt;malo otvoriti, jedva malo rastvoriti&amp;lt;span class=&amp;#34;gp tg_df&amp;#34;&amp;gt;. &amp;lt;/span&amp;gt;&amp;lt;d:def&amp;gt;&amp;lt;/d:def&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;xrg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;xr&amp;#34;&amp;gt;pritvoriti&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_xrg&amp;#34;&amp;gt;: &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;eg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;ex&amp;#34;&amp;gt;odškrinuti vrata &amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_eg&amp;#34;&amp;gt; | &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span role=&amp;#34;text&amp;#34; class=&amp;#34;eg&amp;#34;&amp;gt;&amp;lt;span class=&amp;#34;ex&amp;#34;&amp;gt;odškrinuti prozor&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;#34;gp tg_eg&amp;#34;&amp;gt;. &amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/d:entry&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;making-sense-of-definitions-xml&#34;&gt;Making sense of definitions XML&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s the main part of the app, but also there is not much to tell about here. This was mostly trial and error process, and it&amp;rsquo;s not finished. But it&amp;rsquo;s good enough for my purposes.&lt;/p&gt;
&lt;p&gt;I have a text file with my findings but I don&amp;rsquo;t know if it&amp;rsquo;s any generic. For example, there are two types of definitions in the Croatian thesaurus, one is wrapped into nodes with classes &lt;code&gt;.se2.x_xd1.hasSn&lt;/code&gt;, and the other type has &lt;code&gt;.msDict.x_xd1.t_core&lt;/code&gt; classes. And there is a chance I haven&amp;rsquo;t met more types yet, for definitions or other things I try to extract.&lt;/p&gt;
&lt;p&gt;Speaking of, I managed to extract the word itself, transcription, definitions and phrases. More than enough for a flashcard.&lt;/p&gt;
&lt;p&gt;A way to find problematic words and new layouts would be to go through all the words in a dictionary and compare the text that the app extracts and the text that is there, and raise a flag if the two are very different by some metric, even by size. I might do this at some point, and pull requests are very welcome.&lt;/p&gt;
&lt;h2 id=&#34;formatting-it-as-a-flashcard&#34;&gt;Formatting it as a flashcard&lt;/h2&gt;
&lt;p&gt;Logseq has a very easy flashcard format. Two main concepts are marking blocks as cards using &lt;code&gt;#card&lt;/code&gt; and wrapping parts of it into &lt;code&gt;{{cloze ...}}&lt;/code&gt; so it hides them from you while you are trying to remember them. The parsing of it is not ideal (I think it gives up on parsing more than 3 clozes in a block and they don&amp;rsquo;t play nicely with some markdown formatting) but good enough.&lt;/p&gt;
&lt;p&gt;This is what I got:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;- ### {{cloze #{heading.text}}}
  {{cloze #{GENDERS[gender] || gender}#{inflections}}}

  Definitions

  #{definitions}#{definitions2}

  #{phrases.empty? ? &amp;#34;&amp;#34; : &amp;#34;Phrases\n\n  &amp;#34; + phrases}
  #card
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And this is what it looks like rendered:&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;flashcard&#34; src=&#34; /pics/flashcard.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Cards in Logseq are just blocks. It means that it&amp;rsquo;s easy to modify them manually, and if the app formatted something incorrectly or I want to add my own note, I can just do that right when it&amp;rsquo;s shown to me. This proved extremely useful, I often add translations from the languages I know and sometimes synonims, phrases and associations have more use for me than the definition itself.&lt;/p&gt;
&lt;h2 id=&#34;wrapping-it-all-into-an-alfred-workflow&#34;&gt;Wrapping it all into an Alfred workflow&lt;/h2&gt;
&lt;p&gt;I use &lt;a href=&#34;https://www.alfredapp.com/&#34;&gt;Alfred&lt;/a&gt; to run things, be it an app, a file, or a helper. It&amp;rsquo;s really nice and allows to make your own workflows. So I made one. It takes the word, find the definition, puts it into logseq, and also opens the word in the dictionary app.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;alfred&#34; src=&#34; /pics/card-alfred-workflow.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;At the moment of writing I have 192 cards, and 8 to repeat now. Spaced repetition works ok, the whole thing is convenient and surprisingly doesn&amp;rsquo;t break every other word. Styles could be better but could be worse.&lt;/p&gt;
&lt;p&gt;It also checks local-first and works-on-mobile boxes, because logseq can sync its&amp;rsquo; files via icloud. I actually use both if I want to read offline, and to practice while on mobile.&lt;/p&gt;
&lt;p&gt;The video demo is in the &lt;a href=&#34;https://github.com/s-mage/dict-to-flashcard&#34;&gt;repo&lt;/a&gt;, go check it out.&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Improving CSS in Firefox Reader Mode</title>
      <link>https://smagin.fyi/posts/reader-mode-css/</link>
      <pubDate>Sat, 19 Oct 2024 10:00:00 +0100</pubDate>
      <guid>https://smagin.fyi/posts/reader-mode-css/</guid>
      <description>&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://gist.github.com/s-mage/b5ce48a23b04459b168ef3aadd15bfe2&#34;&gt;gist&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://phabricator.services.mozilla.com/D226989&#34;&gt;patch&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Firefox &lt;a href=&#34;https://support.mozilla.org/en-US/kb/firefox-reader-view-clutter-free-web-pages&#34;&gt;reader mode&lt;/a&gt; is a great idea. Most of the websites, including this one, are not as pleasant to read as &lt;a href=&#34;https://gwern.net/&#34;&gt;gwern.net&lt;/a&gt;, and it&amp;rsquo;s fine. Writing a blog post doesn&amp;rsquo;t have to be a design exercise.&lt;/p&gt;
&lt;p&gt;In reader mode, Firefox takes the content of the page and renders it in a different layout, supposedly better for reading. You can set up some of the things there, but there are edge cases when you can&amp;rsquo;t and it&amp;rsquo;s clearly broken.&lt;/p&gt;
&lt;p&gt;Partly this is because reader mode is an impossible task. You normalize anything into a standard layout. While it&amp;rsquo;s mostly just a bunch of paragraphs and pictures, people sometimes get creative with code, quotes, tables and all sorts of custom layout.&lt;/p&gt;
&lt;p&gt;That said, we can make some styles marginally better.&lt;/p&gt;
&lt;h2 id=&#34;fonts&#34;&gt;Fonts&lt;/h2&gt;
&lt;p&gt;Firefox doesn&amp;rsquo;t respect the browser&amp;rsquo;s default fonts. But you can force it to.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;font settings&#34; src=&#34; /pics/firefox-font-settings.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Font settings say Source Serif&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;default font-family&#34; src=&#34; /pics/firefox-font-family.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Used font family is somehow Georgia&lt;/p&gt;
&lt;p&gt;First of, you need to allow custom css.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;a href=&#34;#ZgotmplZ&#34;&gt;about:support&lt;/a&gt; in the address bar&lt;/li&gt;
&lt;li&gt;Find &amp;ldquo;Profile Folder&amp;rdquo; there, open the folder&lt;/li&gt;
&lt;li&gt;Create chrome/userContent.css file there &amp;ndash; this will be the place to add custom css&lt;/li&gt;
&lt;li&gt;Open &lt;a href=&#34;#ZgotmplZ&#34;&gt;about:config&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;toolkit.legacyUserProfileCustomizations.stylesheets&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Reload the browser&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll need to reload the browser every time you change your custom css.&lt;/p&gt;
&lt;p&gt;This custom css is applied to every web page, so we&amp;rsquo;ll need a selector for just the reader more. Conveniently, reader mode wraps articles into &lt;code&gt;.moz-reader-content&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So, fonts.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.moz-reader-content { font-family: serif; }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will use the serif font from the settings. Tada.&lt;/p&gt;
&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
&lt;p&gt;By default they are weirdly rounded, and if two of them are put next to each other, they look too close.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.moz-reader-content blockquote {
  border-radius: 0 !important;
  border-inline-start-color: #717275 !important;
}

.moz-reader-content blockquote + blockquote {
  margin-top: calc(8px + var(--line-height) * 0.8) !important;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;quotes before&#34; src=&#34; /pics/firefox-quotes-before.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Quotes before&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;quotes after&#34; src=&#34; /pics/firefox-quotes-after.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Quotes after&lt;/p&gt;
&lt;h2 id=&#34;code-blocks&#34;&gt;Code Blocks&lt;/h2&gt;
&lt;p&gt;Some people can&amp;rsquo;t just use &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; and call it a day, so there are all sorts of wrappers that sometimes make DOM structures like &lt;code&gt;table &amp;gt; tr + tr &amp;gt; div &amp;gt; pre &amp;gt; code&lt;/code&gt;. I probably can&amp;rsquo;t fix all of them but I can fix what I meet. So far the snippet is&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.moz-reader-content pre code {
  border: none !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  font-size: 16px;
}

/* sometimes it puts code into tables :shrug: */
.moz-reader-content table pre {
  margin: 0 !important;
  display: table-cell;
  padding: 0 !important;
}

/* p inside table almost definitely means code */
.moz-reader-content td div {
  display: contents;
}
.moz-reader-content td p {
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 2;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Still not ideal, but better than before.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;code before&#34; src=&#34; /pics/firefox-code-before.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Code before&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;code after&#34; src=&#34; /pics/firefox-code-after.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Code after&lt;/p&gt;
&lt;h2 id=&#34;selection-color&#34;&gt;Selection Color&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s a nasty nitpick, but I find it looking much nicer this way:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;::selection {
  background-color: #333333 !important;
  color: white !important;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that &lt;code&gt;.moz-reader-content&lt;/code&gt; is not used here, so it&amp;rsquo;s applied everywhere.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;selected text&#34; src=&#34; /pics/firefox-selection-color.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The code is &lt;a href=&#34;https://gist.github.com/s-mage/b5ce48a23b04459b168ef3aadd15bfe2&#34;&gt;on GitHub&lt;/a&gt;. If you know how to make it a pull request somewhere let me know.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; Firefox has a &lt;a href=&#34;https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html#firefox-contributors-quick-reference&#34;&gt;contributors guide&lt;/a&gt;, but basically you need to clone the repo and make a PR but every tool they use is special and breaks on every step, but not hopelessly and I managed to make &lt;a href=&#34;https://phabricator.services.mozilla.com/D226989&#34;&gt;a PR&lt;/a&gt; for the fonts part. If it works I&amp;rsquo;ll try and turn the other bits into PRs too. Should be easy for blockquotes and significantly more work (probably in the readability repo) for the code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPD2:&lt;/strong&gt; My pr is merged!&lt;/p&gt;
</description>
      <content:encoded>&lt;h2 id=&#34;tldr&#34;&gt;TL;DR&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://gist.github.com/s-mage/b5ce48a23b04459b168ef3aadd15bfe2&#34;&gt;gist&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://phabricator.services.mozilla.com/D226989&#34;&gt;patch&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Firefox &lt;a href=&#34;https://support.mozilla.org/en-US/kb/firefox-reader-view-clutter-free-web-pages&#34;&gt;reader mode&lt;/a&gt; is a great idea. Most of the websites, including this one, are not as pleasant to read as &lt;a href=&#34;https://gwern.net/&#34;&gt;gwern.net&lt;/a&gt;, and it&amp;rsquo;s fine. Writing a blog post doesn&amp;rsquo;t have to be a design exercise.&lt;/p&gt;
&lt;p&gt;In reader mode, Firefox takes the content of the page and renders it in a different layout, supposedly better for reading. You can set up some of the things there, but there are edge cases when you can&amp;rsquo;t and it&amp;rsquo;s clearly broken.&lt;/p&gt;
&lt;p&gt;Partly this is because reader mode is an impossible task. You normalize anything into a standard layout. While it&amp;rsquo;s mostly just a bunch of paragraphs and pictures, people sometimes get creative with code, quotes, tables and all sorts of custom layout.&lt;/p&gt;
&lt;p&gt;That said, we can make some styles marginally better.&lt;/p&gt;
&lt;h2 id=&#34;fonts&#34;&gt;Fonts&lt;/h2&gt;
&lt;p&gt;Firefox doesn&amp;rsquo;t respect the browser&amp;rsquo;s default fonts. But you can force it to.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;font settings&#34; src=&#34; /pics/firefox-font-settings.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Font settings say Source Serif&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;default font-family&#34; src=&#34; /pics/firefox-font-family.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Used font family is somehow Georgia&lt;/p&gt;
&lt;p&gt;First of, you need to allow custom css.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;a href=&#34;#ZgotmplZ&#34;&gt;about:support&lt;/a&gt; in the address bar&lt;/li&gt;
&lt;li&gt;Find &amp;ldquo;Profile Folder&amp;rdquo; there, open the folder&lt;/li&gt;
&lt;li&gt;Create chrome/userContent.css file there &amp;ndash; this will be the place to add custom css&lt;/li&gt;
&lt;li&gt;Open &lt;a href=&#34;#ZgotmplZ&#34;&gt;about:config&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;toolkit.legacyUserProfileCustomizations.stylesheets&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Reload the browser&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll need to reload the browser every time you change your custom css.&lt;/p&gt;
&lt;p&gt;This custom css is applied to every web page, so we&amp;rsquo;ll need a selector for just the reader more. Conveniently, reader mode wraps articles into &lt;code&gt;.moz-reader-content&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So, fonts.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.moz-reader-content { font-family: serif; }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will use the serif font from the settings. Tada.&lt;/p&gt;
&lt;h2 id=&#34;blockquotes&#34;&gt;Blockquotes&lt;/h2&gt;
&lt;p&gt;By default they are weirdly rounded, and if two of them are put next to each other, they look too close.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.moz-reader-content blockquote {
  border-radius: 0 !important;
  border-inline-start-color: #717275 !important;
}

.moz-reader-content blockquote + blockquote {
  margin-top: calc(8px + var(--line-height) * 0.8) !important;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;quotes before&#34; src=&#34; /pics/firefox-quotes-before.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Quotes before&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;quotes after&#34; src=&#34; /pics/firefox-quotes-after.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Quotes after&lt;/p&gt;
&lt;h2 id=&#34;code-blocks&#34;&gt;Code Blocks&lt;/h2&gt;
&lt;p&gt;Some people can&amp;rsquo;t just use &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; and call it a day, so there are all sorts of wrappers that sometimes make DOM structures like &lt;code&gt;table &amp;gt; tr + tr &amp;gt; div &amp;gt; pre &amp;gt; code&lt;/code&gt;. I probably can&amp;rsquo;t fix all of them but I can fix what I meet. So far the snippet is&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.moz-reader-content pre code {
  border: none !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 0 !important;
  font-size: 16px;
}

/* sometimes it puts code into tables :shrug: */
.moz-reader-content table pre {
  margin: 0 !important;
  display: table-cell;
  padding: 0 !important;
}

/* p inside table almost definitely means code */
.moz-reader-content td div {
  display: contents;
}
.moz-reader-content td p {
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  line-height: 2;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Still not ideal, but better than before.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;code before&#34; src=&#34; /pics/firefox-code-before.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Code before&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;code after&#34; src=&#34; /pics/firefox-code-after.jpg&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Code after&lt;/p&gt;
&lt;h2 id=&#34;selection-color&#34;&gt;Selection Color&lt;/h2&gt;
&lt;p&gt;That&amp;rsquo;s a nasty nitpick, but I find it looking much nicer this way:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;::selection {
  background-color: #333333 !important;
  color: white !important;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Note that &lt;code&gt;.moz-reader-content&lt;/code&gt; is not used here, so it&amp;rsquo;s applied everywhere.&lt;/p&gt;
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;selected text&#34; src=&#34; /pics/firefox-selection-color.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;The code is &lt;a href=&#34;https://gist.github.com/s-mage/b5ce48a23b04459b168ef3aadd15bfe2&#34;&gt;on GitHub&lt;/a&gt;. If you know how to make it a pull request somewhere let me know.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPD:&lt;/strong&gt; Firefox has a &lt;a href=&#34;https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html#firefox-contributors-quick-reference&#34;&gt;contributors guide&lt;/a&gt;, but basically you need to clone the repo and make a PR but every tool they use is special and breaks on every step, but not hopelessly and I managed to make &lt;a href=&#34;https://phabricator.services.mozilla.com/D226989&#34;&gt;a PR&lt;/a&gt; for the fonts part. If it works I&amp;rsquo;ll try and turn the other bits into PRs too. Should be easy for blockquotes and significantly more work (probably in the readability repo) for the code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UPD2:&lt;/strong&gt; My pr is merged!&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Code Highlighting</title>
      <link>https://smagin.fyi/posts/colorscheme/</link>
      <pubDate>Sun, 11 Sep 2022 10:00:50 +0100</pubDate>
      <guid>https://smagin.fyi/posts/colorscheme/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Code highlighting is usually treated as highlighting as many things as possible. For example:&lt;/p&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colorscheme_darkula_light.png&#34; alt=&#34;Darkula Light&#34; title=&#34;Darkula light&#34; class=&#34;wide-image&#34; /&gt;
&lt;p&gt;This is darkula-light, but colorschemes are all the same for the sake of the argument. There is A LOT happening on the image, everything is of the different color and as a result nothing is really highlighted. Well, the apple logo draws the attention the most, is that the expected result?&lt;/p&gt;
&lt;p&gt;This post is about to offer a colorscheme where things that require attention are highlighted, and other are not.&lt;/p&gt;
&lt;h2 id=&#34;what-to-highlight-in-code&#34;&gt;What to highlight in code&lt;/h2&gt;
&lt;p&gt;I love the expression &amp;ldquo;from the first principles&amp;rdquo;, but find it too pretentious. Let&amp;rsquo;s just outline what we want to highlight.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Things I explicitly asked to highlight.&lt;/strong&gt; Search terms mainly. Would be strange not to highlight them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Comments.&lt;/strong&gt; People hopefully wrote comments because code was not expressive enough about why something is done whe way it&amp;rsquo;s done. This could also motivate to remove commented code, follow linter rules and write only comments that are needed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Linter errors.&lt;/strong&gt; If a linter thinks the code is wrong you better fix it sooner than later. So let&amp;rsquo;s give it an instrument to annoy you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Git diff.&lt;/strong&gt; &lt;a href=&#34;https://github.com/mookid/diffr&#34;&gt;diffr&lt;/a&gt; got this right.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pair of the bracket or quote under cursor.&lt;/strong&gt; Counting brackets is a programmers&amp;rsquo; hobby, let&amp;rsquo;s suck the last joy from their lives. I&amp;rsquo;m kidding, it&amp;rsquo;s really useful.&lt;/p&gt;
&lt;p&gt;This is it. I can&amp;rsquo;t find a reason why keywords, constants or anything else should draw my attention. Fight me.&lt;/p&gt;
&lt;h2 id=&#34;what-to-highlight-outside-of-the-code&#34;&gt;What to highlight outside of the code&lt;/h2&gt;
&lt;p&gt;There is an excellent review of a book &lt;a href=&#34;https://elvischidera.com/2022-06-24-design-everyday-things&#34;&gt;The Design of Everyday Things&lt;/a&gt;. Design is hard but it&amp;rsquo;s not a total black magic. It can be decomposed and there is a number of things to look at when designing things.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not Don Norman and generally pretty lame at this so don&amp;rsquo;t trust me on the concrete examples. Having said that,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make interface minimal. You don&amp;rsquo;t need current path, sidebar, second sidebar and a terminal open at the same time. Stick to the code itself.&lt;/li&gt;
&lt;li&gt;Make it clear where one piece ends and another piece starts. There is no border between different buffers, panels and basically anything on the first picture of this post, and this is confusing.&lt;/li&gt;
&lt;li&gt;Allow code folding. Turn it off by default though. It is useful in very niche use cases like checking tests by headings, mostly you want to read code from top to bottom or jump through definitions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The main goal of these suggestions is that code editor should not disturb you reading code.&lt;/p&gt;
&lt;h2 id=&#34;pics&#34;&gt;Pics&lt;/h2&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colorscheme_code.png&#34; alt=&#34;code highlighted&#34; title=&#34;This blog post expressed as a colorscheme&#34; class=&#34;wide-image&#34; /&gt;
This blog post expressed as a colorscheme
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;git diff&#34; src=&#34; /pics/colorscheme_diff.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Git diff&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Don&amp;rsquo;t highlight everything at once, this kills the idea of it. Most of the highlighthing should be temporary.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&#34;https://gist.github.com/s-mage/514bb4c41a06006ee40450ca8415c6c9&#34;&gt;link&lt;/a&gt; at my attempt on highlighting for (neo)vim.&lt;/p&gt;
</description>
      <content:encoded>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Code highlighting is usually treated as highlighting as many things as possible. For example:&lt;/p&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colorscheme_darkula_light.png&#34; alt=&#34;Darkula Light&#34; title=&#34;Darkula light&#34; class=&#34;wide-image&#34; /&gt;
&lt;p&gt;This is darkula-light, but colorschemes are all the same for the sake of the argument. There is A LOT happening on the image, everything is of the different color and as a result nothing is really highlighted. Well, the apple logo draws the attention the most, is that the expected result?&lt;/p&gt;
&lt;p&gt;This post is about to offer a colorscheme where things that require attention are highlighted, and other are not.&lt;/p&gt;
&lt;h2 id=&#34;what-to-highlight-in-code&#34;&gt;What to highlight in code&lt;/h2&gt;
&lt;p&gt;I love the expression &amp;ldquo;from the first principles&amp;rdquo;, but find it too pretentious. Let&amp;rsquo;s just outline what we want to highlight.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Things I explicitly asked to highlight.&lt;/strong&gt; Search terms mainly. Would be strange not to highlight them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Comments.&lt;/strong&gt; People hopefully wrote comments because code was not expressive enough about why something is done whe way it&amp;rsquo;s done. This could also motivate to remove commented code, follow linter rules and write only comments that are needed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Linter errors.&lt;/strong&gt; If a linter thinks the code is wrong you better fix it sooner than later. So let&amp;rsquo;s give it an instrument to annoy you.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Git diff.&lt;/strong&gt; &lt;a href=&#34;https://github.com/mookid/diffr&#34;&gt;diffr&lt;/a&gt; got this right.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pair of the bracket or quote under cursor.&lt;/strong&gt; Counting brackets is a programmers&amp;rsquo; hobby, let&amp;rsquo;s suck the last joy from their lives. I&amp;rsquo;m kidding, it&amp;rsquo;s really useful.&lt;/p&gt;
&lt;p&gt;This is it. I can&amp;rsquo;t find a reason why keywords, constants or anything else should draw my attention. Fight me.&lt;/p&gt;
&lt;h2 id=&#34;what-to-highlight-outside-of-the-code&#34;&gt;What to highlight outside of the code&lt;/h2&gt;
&lt;p&gt;There is an excellent review of a book &lt;a href=&#34;https://elvischidera.com/2022-06-24-design-everyday-things&#34;&gt;The Design of Everyday Things&lt;/a&gt;. Design is hard but it&amp;rsquo;s not a total black magic. It can be decomposed and there is a number of things to look at when designing things.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not Don Norman and generally pretty lame at this so don&amp;rsquo;t trust me on the concrete examples. Having said that,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make interface minimal. You don&amp;rsquo;t need current path, sidebar, second sidebar and a terminal open at the same time. Stick to the code itself.&lt;/li&gt;
&lt;li&gt;Make it clear where one piece ends and another piece starts. There is no border between different buffers, panels and basically anything on the first picture of this post, and this is confusing.&lt;/li&gt;
&lt;li&gt;Allow code folding. Turn it off by default though. It is useful in very niche use cases like checking tests by headings, mostly you want to read code from top to bottom or jump through definitions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The main goal of these suggestions is that code editor should not disturb you reading code.&lt;/p&gt;
&lt;h2 id=&#34;pics&#34;&gt;Pics&lt;/h2&gt;
&lt;img src=&#34;https://smagin.fyi/pics/colorscheme_code.png&#34; alt=&#34;code highlighted&#34; title=&#34;This blog post expressed as a colorscheme&#34; class=&#34;wide-image&#34; /&gt;
This blog post expressed as a colorscheme
&lt;p&gt;










&lt;figure class=&#34;&#34;&gt;

    &lt;div&gt;
        &lt;img loading=&#34;lazy&#34; alt=&#34;git diff&#34; src=&#34; /pics/colorscheme_diff.png&#34;&gt;
    &lt;/div&gt;

    
&lt;/figure&gt;
Git diff&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Don&amp;rsquo;t highlight everything at once, this kills the idea of it. Most of the highlighthing should be temporary.&lt;/p&gt;
&lt;p&gt;Here is a &lt;a href=&#34;https://gist.github.com/s-mage/514bb4c41a06006ee40450ca8415c6c9&#34;&gt;link&lt;/a&gt; at my attempt on highlighting for (neo)vim.&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Forms in Vue</title>
      <link>https://smagin.fyi/posts/forms/</link>
      <pubDate>Thu, 26 Dec 2019 10:00:50 +0100</pubDate>
      <guid>https://smagin.fyi/posts/forms/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Every SPA has its library of input groups. And when such an extensive work as wrapping every input type into a label and adding consistent styles between them is done, developers are tempted to handle forms by themselves. It doesn&amp;rsquo;t look too hard but turns into &lt;a href=&#34;https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule&#34;&gt;Greenspun&amp;rsquo;s tenth rule&lt;/a&gt; all the time.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Substitute C to home-made abstractions, Common Lisp to built-in browser APIs, and here you are.&lt;/p&gt;
&lt;p&gt;I spent two days to understand how to handle forms and to build my lib if NIH hits me hard in the process. Thankfully, it didn&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;When I need a forms library, I need validations handling in all its complexity.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cross-field validation. The most common example of such validation is password + password confirmation;&lt;/li&gt;
&lt;li&gt;Errors from the backend. These may be quite a puzzle because backends are different; responses can&amp;rsquo;t always be automatically matched to inputs. So some flexibility here definitely won&amp;rsquo;t hurt.&lt;/li&gt;
&lt;li&gt;Strategies of displaying validation errors. When to show messages, when to hide them, when to change invalid indications to valid, all that stuff.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I don&amp;rsquo;t need&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;form groups as label + input + whatnot, they are different on every site&lt;/li&gt;
&lt;li&gt;nested forms: while there is a convention of sending nested attributes as &lt;code&gt;name_of_nested[]&lt;/code&gt;, this has nothing to do with a forms lib. Well, you can abstract input name, but it&amp;rsquo;s penny-wise.&lt;/li&gt;
&lt;li&gt;submit: forms should send formData, no extra juggling needed. Except handling errors from the server, but it&amp;rsquo;s a validation problem again.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr style=&#34;background: #78e2a0;&#34;&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: There are plenty of browser APIs and pseudo-classes, but not enough for complex cases. If you feel drowning in boilerplate and broken reactivity, use &lt;code&gt;vue-form&lt;/code&gt;. If you feel like &amp;ldquo;the final push and I&amp;rsquo;ll be there,&amp;rdquo; don&amp;rsquo;t fool yourself and use &lt;code&gt;vue-form&lt;/code&gt;.&lt;/p&gt;
&lt;hr style=&#34;background: #78e2a0;&#34;&gt;
&lt;p&gt;I checked four options and have a clear favorite.&lt;/p&gt;
&lt;h2 id=&#34;html5&#34;&gt;HTML5&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation&#34;&gt;MDN&lt;/a&gt;, but I&amp;rsquo;ll outline a bit.&lt;/p&gt;
&lt;p&gt;You can reach pretty far without a library for forms. Pseudo-classes like &lt;code&gt;:valid&lt;/code&gt;, &lt;code&gt;:invalid&lt;/code&gt;, &lt;code&gt;:focus&lt;/code&gt;, and &lt;code&gt;:placeholder-shown&lt;/code&gt; allow indicating an error when it&amp;rsquo;s needed. If you can keep browser validation popup and don&amp;rsquo;t need a custom error message, you can get away with that only.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;input:invalid { border: 1px solid red; }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to display error message in another element, but it is constant, &lt;code&gt;:before&lt;/code&gt; or &lt;code&gt;:after&lt;/code&gt; pseudo-elements are to help. Well-written, concise requirements, and not too strict rules might look no worse than reactivity. There is no way to get the actual message except for calling a js method, though.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.password-input:invalid::after {
  content: &amp;#39;Password should contain a letter, a number, first ten digits of Pi and current date in ISO 8601.&amp;#39;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then goes &lt;code&gt;element.checkValidity&lt;/code&gt; and &lt;code&gt;element.validationMessage&lt;/code&gt; in &lt;code&gt;onblur&lt;/code&gt;, &lt;code&gt;oninput&lt;/code&gt;, &lt;code&gt;onchange&lt;/code&gt; callbacks and so on. This level brings much more pain and intense desire not to abstract all this by yourself and bring a library. But for a couple of forms could work.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;element.setCustomValidity&lt;/code&gt; helps with server response and cross-element validations.&lt;/p&gt;
&lt;p&gt;Things get even more complicated with reactive frameworks. You don&amp;rsquo;t have control over your DOM and should always take into account that your form gets re-rendered all the time. This fact means that there should be a state object that persists between renders. &lt;a href=&#34;https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constraints&#34;&gt;HTML standard&lt;/a&gt; describes the validation state pretty clearly. If you can and want to handle it all yourself, you should release your own forms library. But &lt;a href=&#34;https://github.com/fergaldoyle/vue-form&#34;&gt;&lt;code&gt;vue-form&lt;/code&gt;&lt;/a&gt; already exists.&lt;/p&gt;
&lt;h2 id=&#34;vue-form&#34;&gt;vue-form&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/fergaldoyle/vue-form&#34;&gt;link&lt;/a&gt;, read it carefully.&lt;/p&gt;
&lt;p&gt;I rarely say it, but I understand what every piece of this lib is for, and I don&amp;rsquo;t mind it. Moreover, I am amazed by how the lib author used vue abilities and their own creativity to build a very concise and flexible instrument.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;validate /&amp;gt;&lt;/code&gt; validates inputs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;vue-form :state=&amp;quot;formstate&amp;quot; /&amp;gt;&lt;/code&gt; is a form state copied to object. And this is the way to combine reactivity and forms. Implemented carefully.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;field-messages /&amp;gt;&lt;/code&gt; picks up errors from form state and passes them to slots.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Good thing that it uses HTML attributes from &lt;code&gt;&amp;lt;input /&amp;gt;&lt;/code&gt;s.&lt;/p&gt;
&lt;p&gt;Nested forms and adding extra inputs work without extra efforts as &lt;code&gt;formstate&lt;/code&gt; is a parameter and survives between renders. Looks something like that:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;div v-for=&amp;#34;(account, i) in model.accounts&amp;#34; :key=&amp;#34;i&amp;#34;&amp;gt;
  &amp;lt;validate auto-label&amp;gt;
    &amp;lt;label&amp;gt;Site&amp;lt;/label&amp;gt;
    &amp;lt;input type=&amp;#34;text&amp;#34; :name=&amp;#34;`accounts[${i}].sitename`&amp;#34; required v-model=&amp;#34;model.accounts[i].sitename&amp;#34; /&amp;gt;
    &amp;lt;field-messages auto-label :name=&amp;#34;`accounts[${i}].sitename`&amp;#34;  show=&amp;#34;$touched || $submitted&amp;#34;&amp;gt;
      Success!
      &amp;lt;div slot=&amp;#34;required&amp;#34;&amp;gt;required&amp;lt;/div&amp;gt;
    &amp;lt;/field-messages&amp;gt;
  &amp;lt;/validate&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Different strategies of displaying errors can be flexibly implemented using &lt;code&gt;$dirty, $valid, $touched, $focused, $submitted&lt;/code&gt; flags and v-modal sorcery: &lt;code&gt;v-model&lt;/code&gt; listens for the &lt;code&gt;input&lt;/code&gt; event, &lt;code&gt;v-model.lazy&lt;/code&gt; doesn&amp;rsquo;t, only &lt;code&gt;blur&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Server errors should not be part of the validation but should use an input state. E.g.,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;validate auto-label&amp;gt;
  &amp;lt;input name=&amp;#34;my-input-name&amp;#34; /&amp;gt;
  &amp;lt;div class=&amp;#34;server-error&amp;#34; v-show=&amp;#34;formstate[&amp;#39;my-input-name&amp;#39;] &amp;amp;&amp;amp; !formstate[&amp;#39;my-input-name&amp;#39;].$touched&amp;#34;&amp;gt;
    {{serverErrors[&amp;#39;my-input-name&amp;#39;]}}
  &amp;lt;/div&amp;gt;
&amp;lt;/validate&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Overall It&amp;rsquo;s a minimal possible wrapper that doesn&amp;rsquo;t seem to leak. Like it.&lt;/p&gt;
&lt;p&gt;Full example:&lt;/p&gt;
&lt;script async src=&#34;//jsfiddle.net/smage/9h7v43oy/73/embed/js,html,result/dark/&#34;&gt;&lt;/script&gt;
&lt;h2 id=&#34;vee-validate&#34;&gt;vee-validate&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://logaretm.github.io/vee-validate/&#34;&gt;link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;ValidationProvider /&amp;gt;&lt;/code&gt; wraps an element and gives validation error as slot prop.
&lt;code&gt;&amp;lt;ValidationObserver /&amp;gt;&lt;/code&gt; wraps several elements for cross-element validation or just form handling. Alien rules for that, but that&amp;rsquo;s possible. Validation works not all the time, even in examples.&lt;/p&gt;
&lt;p&gt;Validation rules should be set in &lt;code&gt;&amp;lt;ValidationProvider /&amp;gt;&lt;/code&gt; instead of the input. Not a big deal, but meh.&lt;/p&gt;
&lt;p&gt;The lib has 27 built-in validation rules. Nice, indicates that authors use it on some mature site.&lt;/p&gt;
&lt;p&gt;Localization presence seems weird. I think it should be a separate lib.&lt;/p&gt;
&lt;p&gt;Unnecessary verbose and reinvents too many wheels, but tries hard.&lt;/p&gt;
&lt;h2 id=&#34;vue-simpleform&#34;&gt;vue-simpleform&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/blocka/vue-simpleform&#34;&gt;link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Formik inspired it. Formik is a famous library for react. I&amp;rsquo;m not a fan, but it&amp;rsquo;s one of the best libs in the ecosystem.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;SimpleForm /&amp;gt;&lt;/code&gt; provides &lt;code&gt;validate&lt;/code&gt; and &lt;code&gt;handleSubmit&lt;/code&gt; callbacks.&lt;/p&gt;
&lt;p&gt;The lib is brutally honest, doesn&amp;rsquo;t even pretend to support HTML attributes. Validate is a js function. You can bring a custom validation library (people like &lt;code&gt;yup&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Has &lt;code&gt;touched&lt;/code&gt; and &lt;code&gt;submitted&lt;/code&gt; flags like vue-form, doesn&amp;rsquo;t have &lt;code&gt;focused&lt;/code&gt; and &lt;code&gt;dirty&lt;/code&gt;. Backend responses should be handled similarly to vue-form.&lt;/p&gt;
&lt;p&gt;Changing the form object might break the validation state, not sure about it.&lt;/p&gt;
&lt;p&gt;The lib is yet to mature, but I like the idea.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Start without a library, but bring &lt;code&gt;vue-form&lt;/code&gt; in case of any non-trivial work on the horizon.&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constraints&#34;&gt;WHATWG Constraints&lt;/a&gt;
&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/Constraint_validation&#34;&gt;MDN Constraint Validation&lt;/a&gt;
&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation&#34;&gt;MDN Form Validation&lt;/a&gt;
&lt;a href=&#34;https://css-tricks.com/form-validation-ux-html-css/&#34;&gt;CSS Tricks Form Validation UX&lt;/a&gt;
&lt;a href=&#34;https://css-tricks.com/almanac/selectors/p/placeholder-shown/&#34;&gt;CSS Tricks :placeholder-shown&lt;/a&gt; (doesn&amp;rsquo;t work in IE)&lt;/p&gt;
</description>
      <content:encoded>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;
&lt;p&gt;Every SPA has its library of input groups. And when such an extensive work as wrapping every input type into a label and adding consistent styles between them is done, developers are tempted to handle forms by themselves. It doesn&amp;rsquo;t look too hard but turns into &lt;a href=&#34;https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule&#34;&gt;Greenspun&amp;rsquo;s tenth rule&lt;/a&gt; all the time.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Substitute C to home-made abstractions, Common Lisp to built-in browser APIs, and here you are.&lt;/p&gt;
&lt;p&gt;I spent two days to understand how to handle forms and to build my lib if NIH hits me hard in the process. Thankfully, it didn&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;When I need a forms library, I need validations handling in all its complexity.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cross-field validation. The most common example of such validation is password + password confirmation;&lt;/li&gt;
&lt;li&gt;Errors from the backend. These may be quite a puzzle because backends are different; responses can&amp;rsquo;t always be automatically matched to inputs. So some flexibility here definitely won&amp;rsquo;t hurt.&lt;/li&gt;
&lt;li&gt;Strategies of displaying validation errors. When to show messages, when to hide them, when to change invalid indications to valid, all that stuff.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I don&amp;rsquo;t need&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;form groups as label + input + whatnot, they are different on every site&lt;/li&gt;
&lt;li&gt;nested forms: while there is a convention of sending nested attributes as &lt;code&gt;name_of_nested[]&lt;/code&gt;, this has nothing to do with a forms lib. Well, you can abstract input name, but it&amp;rsquo;s penny-wise.&lt;/li&gt;
&lt;li&gt;submit: forms should send formData, no extra juggling needed. Except handling errors from the server, but it&amp;rsquo;s a validation problem again.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr style=&#34;background: #78e2a0;&#34;&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;: There are plenty of browser APIs and pseudo-classes, but not enough for complex cases. If you feel drowning in boilerplate and broken reactivity, use &lt;code&gt;vue-form&lt;/code&gt;. If you feel like &amp;ldquo;the final push and I&amp;rsquo;ll be there,&amp;rdquo; don&amp;rsquo;t fool yourself and use &lt;code&gt;vue-form&lt;/code&gt;.&lt;/p&gt;
&lt;hr style=&#34;background: #78e2a0;&#34;&gt;
&lt;p&gt;I checked four options and have a clear favorite.&lt;/p&gt;
&lt;h2 id=&#34;html5&#34;&gt;HTML5&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation&#34;&gt;MDN&lt;/a&gt;, but I&amp;rsquo;ll outline a bit.&lt;/p&gt;
&lt;p&gt;You can reach pretty far without a library for forms. Pseudo-classes like &lt;code&gt;:valid&lt;/code&gt;, &lt;code&gt;:invalid&lt;/code&gt;, &lt;code&gt;:focus&lt;/code&gt;, and &lt;code&gt;:placeholder-shown&lt;/code&gt; allow indicating an error when it&amp;rsquo;s needed. If you can keep browser validation popup and don&amp;rsquo;t need a custom error message, you can get away with that only.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;input:invalid { border: 1px solid red; }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you want to display error message in another element, but it is constant, &lt;code&gt;:before&lt;/code&gt; or &lt;code&gt;:after&lt;/code&gt; pseudo-elements are to help. Well-written, concise requirements, and not too strict rules might look no worse than reactivity. There is no way to get the actual message except for calling a js method, though.&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;.password-input:invalid::after {
  content: &amp;#39;Password should contain a letter, a number, first ten digits of Pi and current date in ISO 8601.&amp;#39;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then goes &lt;code&gt;element.checkValidity&lt;/code&gt; and &lt;code&gt;element.validationMessage&lt;/code&gt; in &lt;code&gt;onblur&lt;/code&gt;, &lt;code&gt;oninput&lt;/code&gt;, &lt;code&gt;onchange&lt;/code&gt; callbacks and so on. This level brings much more pain and intense desire not to abstract all this by yourself and bring a library. But for a couple of forms could work.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;element.setCustomValidity&lt;/code&gt; helps with server response and cross-element validations.&lt;/p&gt;
&lt;p&gt;Things get even more complicated with reactive frameworks. You don&amp;rsquo;t have control over your DOM and should always take into account that your form gets re-rendered all the time. This fact means that there should be a state object that persists between renders. &lt;a href=&#34;https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constraints&#34;&gt;HTML standard&lt;/a&gt; describes the validation state pretty clearly. If you can and want to handle it all yourself, you should release your own forms library. But &lt;a href=&#34;https://github.com/fergaldoyle/vue-form&#34;&gt;&lt;code&gt;vue-form&lt;/code&gt;&lt;/a&gt; already exists.&lt;/p&gt;
&lt;h2 id=&#34;vue-form&#34;&gt;vue-form&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/fergaldoyle/vue-form&#34;&gt;link&lt;/a&gt;, read it carefully.&lt;/p&gt;
&lt;p&gt;I rarely say it, but I understand what every piece of this lib is for, and I don&amp;rsquo;t mind it. Moreover, I am amazed by how the lib author used vue abilities and their own creativity to build a very concise and flexible instrument.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;validate /&amp;gt;&lt;/code&gt; validates inputs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;vue-form :state=&amp;quot;formstate&amp;quot; /&amp;gt;&lt;/code&gt; is a form state copied to object. And this is the way to combine reactivity and forms. Implemented carefully.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;&amp;lt;field-messages /&amp;gt;&lt;/code&gt; picks up errors from form state and passes them to slots.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Good thing that it uses HTML attributes from &lt;code&gt;&amp;lt;input /&amp;gt;&lt;/code&gt;s.&lt;/p&gt;
&lt;p&gt;Nested forms and adding extra inputs work without extra efforts as &lt;code&gt;formstate&lt;/code&gt; is a parameter and survives between renders. Looks something like that:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;div v-for=&amp;#34;(account, i) in model.accounts&amp;#34; :key=&amp;#34;i&amp;#34;&amp;gt;
  &amp;lt;validate auto-label&amp;gt;
    &amp;lt;label&amp;gt;Site&amp;lt;/label&amp;gt;
    &amp;lt;input type=&amp;#34;text&amp;#34; :name=&amp;#34;`accounts[${i}].sitename`&amp;#34; required v-model=&amp;#34;model.accounts[i].sitename&amp;#34; /&amp;gt;
    &amp;lt;field-messages auto-label :name=&amp;#34;`accounts[${i}].sitename`&amp;#34;  show=&amp;#34;$touched || $submitted&amp;#34;&amp;gt;
      Success!
      &amp;lt;div slot=&amp;#34;required&amp;#34;&amp;gt;required&amp;lt;/div&amp;gt;
    &amp;lt;/field-messages&amp;gt;
  &amp;lt;/validate&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Different strategies of displaying errors can be flexibly implemented using &lt;code&gt;$dirty, $valid, $touched, $focused, $submitted&lt;/code&gt; flags and v-modal sorcery: &lt;code&gt;v-model&lt;/code&gt; listens for the &lt;code&gt;input&lt;/code&gt; event, &lt;code&gt;v-model.lazy&lt;/code&gt; doesn&amp;rsquo;t, only &lt;code&gt;blur&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Server errors should not be part of the validation but should use an input state. E.g.,&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;lt;validate auto-label&amp;gt;
  &amp;lt;input name=&amp;#34;my-input-name&amp;#34; /&amp;gt;
  &amp;lt;div class=&amp;#34;server-error&amp;#34; v-show=&amp;#34;formstate[&amp;#39;my-input-name&amp;#39;] &amp;amp;&amp;amp; !formstate[&amp;#39;my-input-name&amp;#39;].$touched&amp;#34;&amp;gt;
    {{serverErrors[&amp;#39;my-input-name&amp;#39;]}}
  &amp;lt;/div&amp;gt;
&amp;lt;/validate&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Overall It&amp;rsquo;s a minimal possible wrapper that doesn&amp;rsquo;t seem to leak. Like it.&lt;/p&gt;
&lt;p&gt;Full example:&lt;/p&gt;
&lt;script async src=&#34;//jsfiddle.net/smage/9h7v43oy/73/embed/js,html,result/dark/&#34;&gt;&lt;/script&gt;
&lt;h2 id=&#34;vee-validate&#34;&gt;vee-validate&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://logaretm.github.io/vee-validate/&#34;&gt;link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;ValidationProvider /&amp;gt;&lt;/code&gt; wraps an element and gives validation error as slot prop.
&lt;code&gt;&amp;lt;ValidationObserver /&amp;gt;&lt;/code&gt; wraps several elements for cross-element validation or just form handling. Alien rules for that, but that&amp;rsquo;s possible. Validation works not all the time, even in examples.&lt;/p&gt;
&lt;p&gt;Validation rules should be set in &lt;code&gt;&amp;lt;ValidationProvider /&amp;gt;&lt;/code&gt; instead of the input. Not a big deal, but meh.&lt;/p&gt;
&lt;p&gt;The lib has 27 built-in validation rules. Nice, indicates that authors use it on some mature site.&lt;/p&gt;
&lt;p&gt;Localization presence seems weird. I think it should be a separate lib.&lt;/p&gt;
&lt;p&gt;Unnecessary verbose and reinvents too many wheels, but tries hard.&lt;/p&gt;
&lt;h2 id=&#34;vue-simpleform&#34;&gt;vue-simpleform&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/blocka/vue-simpleform&#34;&gt;link&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Formik inspired it. Formik is a famous library for react. I&amp;rsquo;m not a fan, but it&amp;rsquo;s one of the best libs in the ecosystem.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;SimpleForm /&amp;gt;&lt;/code&gt; provides &lt;code&gt;validate&lt;/code&gt; and &lt;code&gt;handleSubmit&lt;/code&gt; callbacks.&lt;/p&gt;
&lt;p&gt;The lib is brutally honest, doesn&amp;rsquo;t even pretend to support HTML attributes. Validate is a js function. You can bring a custom validation library (people like &lt;code&gt;yup&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Has &lt;code&gt;touched&lt;/code&gt; and &lt;code&gt;submitted&lt;/code&gt; flags like vue-form, doesn&amp;rsquo;t have &lt;code&gt;focused&lt;/code&gt; and &lt;code&gt;dirty&lt;/code&gt;. Backend responses should be handled similarly to vue-form.&lt;/p&gt;
&lt;p&gt;Changing the form object might break the validation state, not sure about it.&lt;/p&gt;
&lt;p&gt;The lib is yet to mature, but I like the idea.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Start without a library, but bring &lt;code&gt;vue-form&lt;/code&gt; in case of any non-trivial work on the horizon.&lt;/p&gt;
&lt;h2 id=&#34;sources&#34;&gt;Sources&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constraints&#34;&gt;WHATWG Constraints&lt;/a&gt;
&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/Constraint_validation&#34;&gt;MDN Constraint Validation&lt;/a&gt;
&lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Form_validation&#34;&gt;MDN Form Validation&lt;/a&gt;
&lt;a href=&#34;https://css-tricks.com/form-validation-ux-html-css/&#34;&gt;CSS Tricks Form Validation UX&lt;/a&gt;
&lt;a href=&#34;https://css-tricks.com/almanac/selectors/p/placeholder-shown/&#34;&gt;CSS Tricks :placeholder-shown&lt;/a&gt; (doesn&amp;rsquo;t work in IE)&lt;/p&gt;
</content:encoded>
    </item>
    <item>
      <title>Hello World</title>
      <link>https://smagin.fyi/posts/hello-world/</link>
      <pubDate>Sat, 23 Nov 2019 12:49:26 +0100</pubDate>
      <guid>https://smagin.fyi/posts/hello-world/</guid>
      <description>&lt;p&gt;Hi, I&amp;rsquo;m Sergei. Sometimes I don&amp;rsquo;t fit into 280 symbols. Very rarely sometimes.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m into being useful, so most of my post are how I either made something or helped improving something in someone else&amp;rsquo;s project. When neither is the case, it&amp;rsquo;s probably me written a post on a topic to give links to what I think on a thing instead of writing it from scratch.&lt;/p&gt;
&lt;p&gt;I make &lt;a href=&#34;https://within-means.com&#34;&gt;Within Means&lt;/a&gt; on weekends. I also made
&lt;a href=&#34;https://github.com/s-mage/boring-tomorrow/&#34;&gt;boring-tomorrow&lt;/a&gt;,
&lt;a href=&#34;https://github.com/s-mage/bttt&#34;&gt;bttt&lt;/a&gt;,
&lt;a href=&#34;https://smagin.fyi/posts/dict-to-flashcard/&#34;&gt;dict-to-flashcard&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cv&#34;&gt;CV&lt;/h3&gt;
&lt;p&gt;My professional interests revolve around inclusivity, infrastructure, and improving workplace experience through processes and tools.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inclusivity&lt;/strong&gt; to me is about allowing more people use products. Means to the end vary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;integrate with more services,&lt;/li&gt;
&lt;li&gt;run a product in more countries,&lt;/li&gt;
&lt;li&gt;be a source of integration for more businesses,&lt;/li&gt;
&lt;li&gt;keep a website fast, responsive and accessible,&lt;/li&gt;
&lt;li&gt;promote better UX,&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://smagin.fyi/posts/money-formatting/&#34;&gt;format money correctly&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This might sound broad but each of them has a personal reason. I have a &lt;a href=&#34;https://www.colourblindawareness.org/colour-blindness/types-of-colour-blindness/&#34;&gt;protanomaly&lt;/a&gt; which means I see red color as black when I&amp;rsquo;m tired and barely recognise any numbers in the &lt;a href=&#34;https://en.wikipedia.org/wiki/Ishihara_test&#34;&gt;Ishihara test&lt;/a&gt;. I live in a country without good banks or marketplaces, and can&amp;rsquo;t send money to parents because of where they live. The locale of this country is not very popular on the Internet either, up to a point I submitted a bug report to Unicode CLDR.&lt;/p&gt;
&lt;p&gt;I believe in &lt;a href=&#34;https://en.wikipedia.org/wiki/Curb_cut_effect&#34;&gt;curb cut effect&lt;/a&gt; where a faster and more accessible products benefit everyone, even if designed for specific audiences. There was a time when I used cheap hardware on limited unstable Internet. I&amp;rsquo;m sure many people are still like that. They should still be able to have nice things.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Infrastructure&lt;/strong&gt; is a foundation that users don&amp;rsquo;t think about when it works and can be an endless source of headaches if not.&lt;/p&gt;
&lt;p&gt;Internet infrastructure is many things, it lets you open websites to payments, update software, synchronize and backup anything. When the user is a developer, there are queues and databases and search and CI and whatnot. I believe there are still too many things re-implemented in each and every app that could be infrastructure. At the same time, you should be fine running your own copy of that infra in almost all cases. Exceptions are things like money transfers or logistics that significantly benefit customers from being everywhere.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also cool to work on e.g. heating or water supply or sewage or railways or &amp;ndash; you get it &amp;ndash; just because how important it is.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Workplace experience&lt;/strong&gt; is something of a by-product of working in teams.&lt;/p&gt;
&lt;p&gt;People who crunch work &lt;a href=&#34;https://wiki.c2.com/?CrunchMode&#34;&gt;worse&lt;/a&gt; than those who don&amp;rsquo;t, and there are a whole bunch of issues with health, nerves, family and social life when you work too much.&lt;/p&gt;
&lt;p&gt;When the hours are sorted the 9-5 shouldn&amp;rsquo;t be hours people hate in their lives. Things causing fires and firefighting should be tweaked until they don&amp;rsquo;t, things that make people wait for a computer and each other reorganized and optimized. There should be reasons and mental capacity to be kind to each other. Means to the end, again, vary, but it&amp;rsquo;s a very satisfying job.&lt;/p&gt;
&lt;p&gt;Sometimes I change jobs. If that&amp;rsquo;s the case, here is my &lt;a href=&#34;https://smagin.fyi/cv.html&#34;&gt;CV&lt;/a&gt;.
You can also schedule a meeting with me at &lt;a href=&#34;https://cal.com/smagin/60min&#34;&gt;cal.com/smagin&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;me-on-the-internet&#34;&gt;Me on the Internet&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/s-mage&#34;&gt;s-mage@github&lt;/a&gt;
&lt;a href=&#34;https://mastodon.online/@smagin&#34;&gt;@smagin@mastodon.online&lt;/a&gt;
&lt;a href=&#34;https://twitter.com/s_mage&#34;&gt;s_mage@twitter&lt;/a&gt;&lt;/p&gt;
</description>
      <content:encoded>&lt;p&gt;Hi, I&amp;rsquo;m Sergei. Sometimes I don&amp;rsquo;t fit into 280 symbols. Very rarely sometimes.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m into being useful, so most of my post are how I either made something or helped improving something in someone else&amp;rsquo;s project. When neither is the case, it&amp;rsquo;s probably me written a post on a topic to give links to what I think on a thing instead of writing it from scratch.&lt;/p&gt;
&lt;p&gt;I make &lt;a href=&#34;https://within-means.com&#34;&gt;Within Means&lt;/a&gt; on weekends. I also made
&lt;a href=&#34;https://github.com/s-mage/boring-tomorrow/&#34;&gt;boring-tomorrow&lt;/a&gt;,
&lt;a href=&#34;https://github.com/s-mage/bttt&#34;&gt;bttt&lt;/a&gt;,
&lt;a href=&#34;https://smagin.fyi/posts/dict-to-flashcard/&#34;&gt;dict-to-flashcard&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;cv&#34;&gt;CV&lt;/h3&gt;
&lt;p&gt;My professional interests revolve around inclusivity, infrastructure, and improving workplace experience through processes and tools.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inclusivity&lt;/strong&gt; to me is about allowing more people use products. Means to the end vary:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;integrate with more services,&lt;/li&gt;
&lt;li&gt;run a product in more countries,&lt;/li&gt;
&lt;li&gt;be a source of integration for more businesses,&lt;/li&gt;
&lt;li&gt;keep a website fast, responsive and accessible,&lt;/li&gt;
&lt;li&gt;promote better UX,&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://smagin.fyi/posts/money-formatting/&#34;&gt;format money correctly&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This might sound broad but each of them has a personal reason. I have a &lt;a href=&#34;https://www.colourblindawareness.org/colour-blindness/types-of-colour-blindness/&#34;&gt;protanomaly&lt;/a&gt; which means I see red color as black when I&amp;rsquo;m tired and barely recognise any numbers in the &lt;a href=&#34;https://en.wikipedia.org/wiki/Ishihara_test&#34;&gt;Ishihara test&lt;/a&gt;. I live in a country without good banks or marketplaces, and can&amp;rsquo;t send money to parents because of where they live. The locale of this country is not very popular on the Internet either, up to a point I submitted a bug report to Unicode CLDR.&lt;/p&gt;
&lt;p&gt;I believe in &lt;a href=&#34;https://en.wikipedia.org/wiki/Curb_cut_effect&#34;&gt;curb cut effect&lt;/a&gt; where a faster and more accessible products benefit everyone, even if designed for specific audiences. There was a time when I used cheap hardware on limited unstable Internet. I&amp;rsquo;m sure many people are still like that. They should still be able to have nice things.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Infrastructure&lt;/strong&gt; is a foundation that users don&amp;rsquo;t think about when it works and can be an endless source of headaches if not.&lt;/p&gt;
&lt;p&gt;Internet infrastructure is many things, it lets you open websites to payments, update software, synchronize and backup anything. When the user is a developer, there are queues and databases and search and CI and whatnot. I believe there are still too many things re-implemented in each and every app that could be infrastructure. At the same time, you should be fine running your own copy of that infra in almost all cases. Exceptions are things like money transfers or logistics that significantly benefit customers from being everywhere.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also cool to work on e.g. heating or water supply or sewage or railways or &amp;ndash; you get it &amp;ndash; just because how important it is.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Workplace experience&lt;/strong&gt; is something of a by-product of working in teams.&lt;/p&gt;
&lt;p&gt;People who crunch work &lt;a href=&#34;https://wiki.c2.com/?CrunchMode&#34;&gt;worse&lt;/a&gt; than those who don&amp;rsquo;t, and there are a whole bunch of issues with health, nerves, family and social life when you work too much.&lt;/p&gt;
&lt;p&gt;When the hours are sorted the 9-5 shouldn&amp;rsquo;t be hours people hate in their lives. Things causing fires and firefighting should be tweaked until they don&amp;rsquo;t, things that make people wait for a computer and each other reorganized and optimized. There should be reasons and mental capacity to be kind to each other. Means to the end, again, vary, but it&amp;rsquo;s a very satisfying job.&lt;/p&gt;
&lt;p&gt;Sometimes I change jobs. If that&amp;rsquo;s the case, here is my &lt;a href=&#34;https://smagin.fyi/cv.html&#34;&gt;CV&lt;/a&gt;.
You can also schedule a meeting with me at &lt;a href=&#34;https://cal.com/smagin/60min&#34;&gt;cal.com/smagin&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;me-on-the-internet&#34;&gt;Me on the Internet&lt;/h3&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/s-mage&#34;&gt;s-mage@github&lt;/a&gt;
&lt;a href=&#34;https://mastodon.online/@smagin&#34;&gt;@smagin@mastodon.online&lt;/a&gt;
&lt;a href=&#34;https://twitter.com/s_mage&#34;&gt;s_mage@twitter&lt;/a&gt;&lt;/p&gt;
</content:encoded>
    </item>
  </channel>
</rss>
