TIL #2: tmux, Docker's Architecture, CSS Feature Queries And Lodash.• TIL • siaw23
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.
I’ve since learned to persist sessions in tmux. Yay! It turns out there’s a tmux plugin for that. 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:
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.
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.
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.