Appjeniksaan

Remap Caps Lock to Backspace in macOS

When I switched to Colemak, I also changed my backspace to be located on the caps lock position. When using hobbyist keyboards that I can program, it is simple to just program that key. But for my MacBook keyboard, I thought the only option was using Karabiner Elements. But running that with its virtual keyboard just to map one key feels like overkill.

Today I decided to switch from Colemak to Colemak-DH šŸ«£, but in order to do that, I could no longer use the built-in macOS Input Source to override my keys. It turns out you can create your own Input Source, so I thought maybe I could also override the caps lock there. To my disappointment, this seems to not be the case.

But my googling wasnā€™t for nothing; I came across this post which shows a simple one-line command to change caps lock into backspace šŸ¤Æ

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x70000002A}]}'

The quiet art of attention

There comes a moment in life, often in the quietest of hours, when one realizes that the world will continue on its wayward course, indifferent to our desires or frustrations. And it is then, perhaps, that a subtle truth begins to emerge: the only thing we truly possess, the only thing we might, with enough care, exert some mastery over, is our mind. It is not a realization of resignation, but rather of liberation. For if the mind can be ordered, if it can be made still in the midst of this restless life, then we have already discovered the key to a deeper kind of freedom.

Good code is rarely read

This post got me thinking about the paradox of writing ā€œgoodā€ code. If the code is truly well-written, it will likely be read very rarely. In contrast, poorly written code needs constant tweaking and, therefore, ends up being read a lot.

As developers, our best course of action is probably to strive for maximum readability in our code, with the hope that the code and the logic it embodies will seldom need to be read in the future.

The Art of Finishing

Thereā€™s a certain comfort in the realm of infinite possibility. When a project is ongoing, it can be anything. Itā€™s Schrƶdingerā€™s project ā€” simultaneously perfect and flawed until you actually finish it and put it out into the world. The moment you declare a project ā€œdone,ā€ you open it up to criticism, both external and internal. What if itā€™s not good enough? What if I missed something crucial?

My personal list of projects in progress is quite large, but I like that they allow me to daydream. Sometimes, starting something new means trying out a new tech stack or library. Other times, itā€™s about exploring an idea that sounds great until you actually start working on it and encounter all the odd quirks that seem impossible.

I donā€™t know if having many ongoing projects is a bad thing. The main risk I see is getting overwhelmed by the number of things you want to do and not finishing anything. For me, these projects feel like a hobby and donā€™t have to be taken very seriously. Whether you finish them or leave them open doesnā€™t really matter, as long as you can mentally let go of stale projects.

Programming mantras are proverbs

[ā€¦] understanding that all of our mantras need to be understood as proverbs and not laws.

This post aligns well with the way I think about programming mantras. I see a lot of developers applying a good idea to everything and thereby losing sight of its intent. Considering them as proverbs that can be applied to a specific situation, but should only be used as guidance seems like a healthier way of following their advice.

Slop

With the hype-driven development of AI and companies cramming these features into any project they can find, there is a lot of content being created that isnā€™t worth anyoneā€™s time. I hadnā€™t found a good term to define this, but discovering "slop" seems to fill that void.

Watching in real time as ā€œslopā€ becomes a term of art. the way that ā€œspamā€ became the term for unwanted emails, ā€œslopā€ is going in the dictionary as the term for unwanted AI generated content

The compounding seeds of creativity

Early on in my career, I learned a very important lesson about creativity: It canā€™t be saved for later. Creativity is perishable, just like inspiration. It has to be discharged regularly or it will spoil. And if you let enough of it go to waste, eventually your talents will sour and shrivel with it.

This take from DHH really resonates with my personal experience. You might feel that you should be able to ignore some of the boring day-to-day tasks and switch on creative mode right after, but the mundane bits seem to have quite the effect on the rest. I do find it difficult to avoid this sometimes, but the best way seems to be to not get stuck on failure and just try again.

Table row styling with CSS Grid

Recently I ran into styling issues with a table layout where a lot of columns had to take the minimum amount of space, so certain other columns could take all the room available. The default table styling in CSS is not very flexible, so it would be great to use CSS Grid row such a layout. But with a normal CSS Grid layout you will not have the option to easily style even / odd row backgrounds. When searching how to style even / odd row backgrounds, the suggestions online were pretty outdated. Since subgrid support has become widely available, I think there are better solutions.

An example table

Programming Language Creator First Release
C Dennis Ritchie 1972
Python Guido van Rossum 1991
JavaScript Brendan Eich 1995

The code

To create the table above, we can use the HTML:

<table>
  <thead>
    <tr>  
      <th>Programming Language</th>
      <th>Creator</th>
      <th>First Release</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>C</td>
      <td>Dennis Ritchie</td>
      <td>1972</td>
    </tr>
    <!-- [...additional rows] -->
  </tbody>
</table>

And the styling to make it into a CSS Grid based table:

table {
  display: grid; 
  grid-template-columns: repeat(3, 1fr); /* 3 columns of even width */
}
thead, tbody, tr {
  display: grid; 
  grid-template-columns: subgrid; /* thead, tbody and tr are subgrid */
  grid-column: 1 / -1; /* from the first to the last column */
}
thead tr, tbody tr:nth-of-type(even) {
  background-color: white; /* the header and even rows get alternative background-color */
}
th {
  font-weight: bold;
}

The code above is a very simplified example, but with CSS Grid and subgrid the options for creating advanced table layouts are almost limitless.

Reading Activity

A couple of years ago I gave away almost all my fysical books. Before that moment I had been building quite the little library and kept buying anything that I thought was interesting to read some day. But my growing collection made me feel more and more anxious about the number of pages I still had to read, a cleanup seemed like the best reset.

Right after the purge all was great, but over time more and more books started to pile up on the shelves again. So it was time for another approach. This time, I am dedicating to reading everything that is on the shelves and not purchasing anything new until Iā€™ve read through what I have available. At the moment that is still sort-of overseeable, so it still feels like a challenge and not something completely unreasonable like my situation before the purge.

To hopefully help get a better grasp of how I am making progress I started logging the books Iā€™ve been reading on this domain.

The interesting thing about this approach is that it will get more challenging with time. At the beginning I got to read through books like the The Hitchhiker's Guide to the Galaxy, but at some point I will have to dive into Pale Fire and The Divine Comedy. So fingers crossed for this new approach šŸ¤ž.

Appjeniksaan is my personal software development šŸ›  shop which lets me create sites and apps that I think are delightful or just fun šŸ¤Ŗ to build šŸš€. On this site I will try šŸ™ˆ to share the interesting info I bump into on the www šŸŒ