\( \renewcommand\vec[1]{\mathbf #1} \newcommand\pp[2]{\frac{\partial #1}{\partial #2}} \newcommand\dd[2]{\frac{\mathrm d #1}{\mathrm d #2}} \newcommand\d{\,\mathrm d} \)

花花花 SuperLaserNino 花花花

home · about · archive · RSS

Modifier keys are named all wrong

17 Jan 2020

The option key in macOS should be called alt like on Windows, because it is used to type alternative characters, or to run alternative commands when used in conjunction with the command key. On Windows, the alt key should be called command because you use it to move focus to the menus to execute commands. Then alt gr key on Windows should become the alt key because that’s what you use to type alternative characters. The shift key should be called caps because nobody has used a typewriter in decades, and nothing is being shifted anymore. (The name isn’t perfect because you also use that key to type alternative symbols on the number row, but we already have an alt key. Maybe we could use our now alt key to type all the symbols from the number row and the number keys can produce old-style figures without caps and lining figures with — though that would require changes unicode, so that might be out of scope for this project.) The caps lock key should be dropped entirely and replaced with an escape key that functions as ctrl or command when held down, according to user preferences. On keyboards that have one, the fn key should be renamed to something like alt-ctrl because it’s usually like a ctrl or command key, but it does different things. Maybe special would work, as a nod to the old “Special” menu in Classic Mac OS.

And while we’re renaming keys, the tab key should be renamed to shift because we make tables using the “Insert table” command, not by pressing the tab key. The tab key is used to shift text to the right, or to shift focus to the next input element. (On the other hand, ctrl + tab is used to navigate between browser tabs, but that’s one bit of elegance we can probably do without. (You can still say you’re “shifting” focus to the next browser tab, so it all works out in the end.))

Muscle memory

03 Sep 2019

Fun things I discovered about my muscle memory.

Continue reading →

Are rails partials actually slow?

04 Mar 2018

At my previous job, we were told not to use partials to clean up our view code, because each rendering of a partial would add around 10ms to the overall response time. After I was told this I did a quick test in my dev environment, but I’d never actually tested the claim on production … until today!

Continue reading →

DPI-dependent CSS in Atom and everywhere else too

04 Dec 2017

When programming on low-resolution screens, I like to use 10pt Monaco with antialiasing turned off. But when switching to my MacBook’s retina display, I want antialiasing turned back on. Until now, I would manually comment/uncomment some CSS in Atom’s styles.less file to change this.

Turns out, you can define CSS rules based on the current screen resolution. By adding the following to styles.less, Atom automatically switches the font and antialiasing settings as soon as you move the window from one screen to the other:

atom-text-editor {
  @media (-webkit-max-device-pixel-ratio: 1), (max-resolution: 150dpi) {
    .line {
      -webkit-font-smoothing: none;
      font-family: Monaco;
      font-size: 10;
      transform: translateX(1px);
      font-style: normal !important;
      * {
        font-style: normal !important;
      }
    }
  }
}

The transform line is there because Atom will sometimes cut off the first column of pixels when antialiasing is turned off.

Smooth cursor motion in Atom

08 Oct 2017

I’m currently trying out Atom as the main tool for my computer job and I wanted to make it more fun, so I added some CSS to make the cursor move smoothly and give the text-selection rounded corners. To try it yourself, click click on Stylesheet in the Atom menu and paste this code:

atom-text-editor .cursor {
  transition: all 80ms;
}

atom-text-editor .selection {
  border-radius: 4px;
  transition: all 20ms;
}

Now everything is nice and smooth. Yay!

Big numbers, small numbers

Created: 15 Mar 2017

Modified: 15 Mar 2017

You don’t want things to be complicated. I get it. I am here to help. Don’t worry, it’s all going to be over soon.

Continue reading →

Willpower day

08 Mar 2017

Background

I noticed I wasn’t happy with the way I spend my time. Over the last year or so I learned to structure my work habits such that I need the least amount of willpower possible to get myself to work. I tried hard to get myself to do things without requiring willpower and, in the process, built somewhat of an aversion to do anything that seemed like it might require effort. For the most part, this was good: I learned to notice moments when I just didn’t have the mental capacity to do work, and so learned not to judge myself for sometimes not working and instead looking at comics on the internet.

Continue reading →

Inconsolata LGC with oldstyle numerals

18 Dec 2016

In my perennial quest to make everyone love oldstyle numerals, I decided to make a fork of one of my favorite programming fonts, Inconsolata, and give it oldstyle numerals.

The numbers 0 through 9 set in Inconsolata LGC using oldstyle numerals
This is what it looks like

The font can be downloaded from GitHub.

If I figure out how to properly use FontForge, I’ll also add programming ligatures at some point.