tmux

In February 2021, I learned about tmux and added it to my workflow. It’s been great so far, with a gentle learning curve. My main problem with it now is that I haven’t been able to find a way to implement scrolling.

When I get a very long stack trace, I have to use a standard terminal window to read through. I lose sessions and windows when I restart my machine; it would be nice if the sessions persisted. I’m yet to learn if that is possible. Other than that, it’s nice to work with tmux.

EDIT: I’ve since learned to persist sessions in tmux. Yay! It turns out there’s a tmux plugin for that. The scrolling issue was an easy fix. In my .tmux.conf, I had to pop in set -g mouse on.

CSS Feature Queries

I was pretty stoked when I learned about CSS Media Queries. I thought it was fantastic, and it truly is. For a WebRTC app that I’m working on recently, the building process forced me to learn a bit about CSS Grid and Flexbox. Reading documentation led me to discover CSS Feature Queries. It’s a neat feature that’s available in almost all browsers.

Much like Media Queries, Feature Queries let you run CSS conditionally. In the case of Feature Queries, you can check if a browser supports Flexbox. If it does, you run the Flexbox CSS. Otherwise, you load CSS that tries to mimic some Flexbox effects.

Here’s a how you’d use it:

@supports not (display: grid) {
    // CSS for older browsers.
}
@supports (display: grid) {
    // CSS for newer browsers.
}

Some refer to it as the “@supports rule”. I like the “Feature Queries” name more.

The @supports rule is a conditional group rule whose condition tests whether the user agent supports CSS property:value pairs. W3C

The Architecture of Docker

Docker used the resource features of the Linux kernel to allow containers to run in a Linux instance. It’s more of a Linux product than anything else. I saw some benchmarks running around Twitter about how Rails with Docker development on Macs is slow. Everything makes sense now.

The docker daemon’s native home is a Linux host. If you’re running Docker on any other OS, you’ll pay for the overhead. Docker has to start a Linux virtual machine on a non-Linux host to get things working. For instance, on a Mac, the Docker CLI has to do extra work to forward CLI input to the Docker Daemon.

Lodash

If you write a lot of JavaScript and don’t use Lodash, you’re missing out on a collection of libraries written to keep code modular. I checked out the full suite of Lodash. It has frequently used functions written more concisely, much like how ActiveSupport and Ruby provide ready-made methods to ease programmers’ lives.

For example the raw JavaScript implementation of a function that finds the intersection of two array cannot be prettier than doing it with Lodash:

_.intersection([2, 1], [2, 3]);
// => [2]

There’s a whole lot more utility functions in the documentation.

I like Lodash more when I discovered that it has a debounce function. I can see how this could come in handy when you’re modifying a page when the viewport is resized. This function only invokes the functions after a given amount of time to save the browser from unnecessary work that could hinder performance.

    Powered By ConvertKit
    Follow me on Twitter to explore Ruby, JavaScript and web technologies. Consider subscribing to my newsletter or buying me a coffee if you found any of my content helpful.