❀✿❀ SuperLaserNino ✿❀✿

home · about · archive · RSS

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.

Focusing on the breath

15 Nov 2016

During mindfulness meditation, you’re supposed to focus on your breath. If you encounter any stray thoughts, you’re instructed to notice them and let them pass by, always returning your focus to the breath. I often find it difficult to stay focused on my breath for an extended length of time; it’s easy to start focusing on the breath, but after a short while, I’ll notice I’ve drifted off to thinking about something completely different.

I recently realized that, since it’s easy to shift my focus instead of holding it, it is much easier to focus on one breath at a time. Then, when the breath is over, instead of trying to keep focused, I’d repeat the mental motion of shifting my focus to the breath – again, only for a single breath. This way, I’ve been able to stay focused on my breathing for many minutes without drifting off into other thoughts.

So, in general, this is good, but it also feels like cheating since I’m not actually holding the focus; instead I’m doing a new mental motion after every single breath, which might put me in a less calm state than I’d be in if I could just learn to stay focused. I’d be curious to hear from people who have more experience with meditation, whether this is a bad way of doing things.

Four or five thoughts on scientific writing

18 Aug 2016

A few days ago I handed in my bachelor’s thesis in physics and I had a few thoughts while writing it. Some of these thoughts only apply to literature that features a lot of mathematical equations, but some apply to all academic writing, or all writing in general.

Continue reading →