A Common Counterfeit to Beautiful Code

Code and algorithms and frameworks are only as beautiful as their external-facing APIs. If there is a conceivable API that is better than the one you’re offering, but you don’t want to go down that path because you’re afraid it would compromise the beauty or integrity of your internal code, you’re admitting you’re a handicapped developer who can’t solve hard problems, and you don’t understand what beautiful code is about.

Build the best API you can, then figure out how to make the internal implementation beautiful. If the second half of that is hard, embrace the struggle. This is your job. This is where true craftsmanship shines.

Internals matter, but it makes no sense having a beautiful flower encased in a bloody box. Your code might be worse than the final deliverable, but it can never be better. The external API is the first measuring stick that must be used to determine a code’s merit. If slighted, all else is folly.

Chrome 81 Kills Bold in Native Fonts  

For any font size 20px or greater, in a native font (i.e. San Francisco on a Mac, Segoe UI on Windows), Chrome 81 doesn’t render bold correctly. Font weights declared as bold instead render as normal font weight. Back on March 2, the team knew that this was a problem in Chrome 81:

Marking as P1 blocking for now, until severity / whether it’s intended is assessed. It is in M81 beta but not M80 stable.

After much discussion, the team decided that this wouldn’t block the release of 81. Better yet, they didn’t get it fixed in 82. They’re “punting the bug to M83” which won’t be released until sometime in June.

The only reason you aren’t seeing people complaining up and down on sites like GitHub that heavily utilize native fonts is because GitHub doesn’t use bold font weights at those font sizes. On the other hand, Chess.com uses native fonts as its primary font family, and it liberally uses bold at sizes larger than 19px.1 It stands out like a sore thumb. And we’re stuck with this Chrome bug for months.

It boggles my mind how a bug this serious could be treated in such a cavalier fashion by the Chromium team. Back in the day, just about the only thing a browser could do was render text. That should be a core competency. What gives?


  1. I’m referring to units of pixels for clarity but the astute sleuther will observe that Chess.com is migrating from px to em and rem units, since that’s where the puck seems headed. ↩︎

How I’m Making Weapons-Grade Coffee During Coronavirus

Like much of the nation, the past few weeks I’ve been working from home. Today I’m sharing my process for making great coffee to stay motivated and energized.

Maybe you’re asking, why make great coffee? Why not settle for mediocre? That’s a valid question. After all, it takes less time and money to make mediocre coffee. The honest truth is that in my case, I’ve simply gotten used to great coffee and can’t go back. Heretofore, that great coffee has been prepared by others, but now they’re quarantined just like the rest of ‘Murica, and no longer doing their thing. I’ve lost my source of great coffee.

Most my life, I’ve settled for pre-ground beans in a $50 drip coffee maker. But twenty months ago, I made a decision that moved me up in the coffee world: I started working at a coworking space. Coworking spaces, at least the ones I’m familiar with in Tulsa, source theirs beans from local coffee shops and grind them immediately before a drip batch, for a killer brew. Without realizing it, for nearly two years I’ve grown accustomed to sipping great coffee as a morning ritual.

But now, this seemingly unending source of low-friction caffeine has abruptly ended with Coronavirus. It’s time to work from home, and I noticed something.

Where muy coffee? 😳

That’s when it all became shockingly clear: I had to learn how to make a brew that would give a boutique coffee shop a run for its money. Once you move up in the world, you can’t move down. Not without a fight.

The first step was to run to CTX Coffee, the best coffee shop in the Tulsa metro area, run by my buddy Jacob. I picked up some coffee beans and got his personal insight into what makes a great cup of coffee. I’ve always know a good cup when I taste it, but I was lost as to how to actually achieve such a thing at my own kitchen counter. But it was time to learn.

Jacob stressed that the #1 thing is to get great beans and grind them immediately before brewing. All else is secondary. If you do just this one thing, you’re already in front of the herd.

This is all true, but then again, I needed a way to grind my pricey beans, and an AeroPress intrigued me.

Back home, I hopped on Amazon and picked up a few things.

  1. An AeroPress Coffee and Espresso Maker to actually brew.
  2. The JavaPresse Manual Coffee Grinder to grind my beans. You can get an electric grinder that will be faster, but I liked the idea that I’d be able to make a cup of coffee with zero electricity, using no energy other than my natural gas stove. It takes me about 3 minutes to crush up 15 grams of beans, and it’s therapeutic time well spent.
  3. A Chefbar Tea Kettles Stovetop to precisely measure the temperature of my water.
  4. A Nicewell Food Scale to precisely measure out 15 grams of beans per cup.

The total cost of these Amazon goodies was $130.62. That’s not bad, considering that a professional coffee shop grinder alone could easily run a couple of grand. For a fraction of that, I now had the tools to make an identical brew at a much smaller scale.

The parts arrived a few days later and the game was afoot. The AeroPress came with a simple set of instructions for how to use it and I started making cups of black coffee as well as lattes. The results are some of the best coffee I’ve ever had.

I won’t go into all the step-by-step parts of making a cup of coffee, since Blue Bottle Coffee has a great tutorial complete with fantastic photos. There’s nothing unique to my method. It’s worth noting that Blue Bottle Coffee deviates from the standard instructions that come with the AeroPress by telling you to pour your ground beans into the AeroPress while it’s upside down. This works if you’re making a full cup of coffee, but if you’re just preparing an espresso shot to turn into a latte, you’re best off using the AeroPress right-side-up. Otherwise the wet grounds stick to the bottom of the plunger too much when it comes time to press, and you won’t get the full strength of your grounds.

If you’re looking for where to get good beans and you’re too timid to talk to your local hipster bejeweled barista, check out the $3 sample from Yes Plz. Their coffee is very good. Between that and the Amazon links above, you’ll transform your morning experience while working from home.

I’m off to grind some beans and make a latte.

How to Write Conditional Properties in a Javascript Object’s Initial Declaration  

Let’s say you want to write a single declaration that maybe has a property on it, based on some boolean expression. You can do that like so:

const hasAvatar = false;

const user = {
  firstName: 'martyn',
  ...(hasAvatar) && { avatar: 'link/to/some/avatar' },
};

Here, user is nothing other than:

{ firstName: 'martyn' }

But if you flip hasAvatar to true then it successfully evaluates to:

{ firstName: 'martyn', avatar: 'link/to/some/avatar' }

There are situations where the ability to one-liner an object declaration with conditional properties like this allows you to avoid moving around a lot of stuff you’d otherwise have to refactor. It’s definitely something worth keeping in your wheelhouse.

Transit Goes Old School in Its July Release Notes  

The Transit app release notes from July 1:

My liege,

Your humble servants at the Transit Mobile Application Bug Plumbing Company do henceforth declare the following services Remedied And Restored to Satisfactory Working Order:

Whoever put this together had a good grip of old English. They knew not just the old words, but the old spellings (e.g., “Office Moode”) and the old pronunciation rules (e.g., “an ‘Hilarious GIF’").

A Business Case for Dropping Internet Explorer  

Ollie Williams, writing at CSS Tricks:

The distance between Internet Explorer (IE) 11 and every other major browser is an increasingly gaping chasm. Adding support for a technologically obsolete browser adds an inordinate amount of time and frustration to development. Testing becomes onerous. Bug-fixing looms large. Developers have wanted to abandon IE for years, but is it now financially prudent to do so?

Evan You Teases a Virtual DOM That Beats Svelte’s  

Evan You:

What if I told you I made vdom faster than Svelte 🙀

Two hours later:

Kinda hesitant to post the benchmark (which includes React, which inevitably is going to lead to React devs telling me how perceived perf is the only perf that you should care about, and other pissed off people complaining about how stupid benchmarks mislead devs)

If you picked Svelte over Vue for a project purely on its merits of speed, it’s time to take a step back and reflect on how that’s working out for you.

Changing the User Icon in Chrome  

Burgi:

Once the image is in place there seems no way to change it with a different custom image. FRUSTRATING!

Yesterday I finally got around to adding an avatar to my Google account, but it never updated the avatar that appears to the right of the address bar in Google Chrome. I restarted Chrome, restarted macOS Catalina, no luck. The only solution was to sign out of Google Chrome and sign back in.

The Value of an Awaited Item

While you’re doing an await for a promise in JavaScript, what is its value before it resolves? Answer: whatever it previously was.

let baz = 'hello world';

const foo = async() => {
  baz = await new Promise(resolve => {
    setTimeout(() => {
     resolve('resolved');
    }, 1000);
  });
};

foo();
baz;  // value is 'hello world' until 1 second, at which point it changes to 'resolved'

Didn’t know this until yesterday. 🤓

How to Disable Chrome’s URL Hiding  

Judging by the publish date of this article, apparently this nonsense has been going on for a year and I just haven’t noticed. Or maybe it’s not been enabled by default until a recent update. But regardless, I’ve noticed lately that Chrome is trying to do the same thing Safari did: hide parts of the URL like the “www.” That would be fine, except that when you go to edit the URL, the whole thing jumps around because then it has to insert all the missing pieces. It might be great for people who rarely touch the address bar, but for web developers, it’s no bueno. The secret is to go to chrome://flags, search Steady select Disabled on all the search results, and restart Chrome.

127.1  

Had no idea that 127.0.0.1 was the same as 127.1.

Strava Pulls the Plug on Relive  

Relive:

Strava decided to no longer work with us and shut down our access to your activities. This means you can no longer create Relive videos based on your Strava activities.

[…]

We then tried to call, email, and talk this out with Strava. No response, except for new ultimatums and threats about our existing features they’ve applauded for years.

[…]

Nothing has changed about how Relive uses and protects your data or how we use their API.

This is a very different sounding memo than the email Strava sent last night:

Many of us at Strava have enjoyed using Relive over the last few years, but because of Relive’s recent updates, unfortunately, we have decided to end this integration. The current version of Relive violates several of the terms that we ask of API partners. These terms are in place to safeguard your personal information, to ensure a level playing field for all our partners, and to protect what makes Strava unique. We’ve worked hard with Relive to try to fix this, but they have ultimately chosen not to make the changes needed to honor their agreement. So as of today, Strava will no longer send your activities to Relive for playback.

Does the “current version of Relive violate” terms, or has “nothing changed about how Relive uses” Strava’s API? Has Strava “worked hard with Relive to try to fix this” or has Strava given “no response” to Relive’s calls and emails? It’s hard for me to understand how both of these sides of the story can both be fully factual.

Tech Giants Are Censoring Anti Big Pharma  

Mike Adams:

YouTube has already begun scrubbing historical documentaries as part of its accelerated purge. Facebook is going to start taking down all anti-cancer food channels, and diabetes will be next. MailChimp just started banning all vaccine safety email lists today, blocking any senders from distributing emails that are critical of vaccine safety. Amazon.com is about to dump all small brand nutritional supplements and replace them all with synthetic, toxic vitamin products made by Big Pharma subsidiaries.

This part about MailChimp has been corroborated. It’s disgusting. This means war. For the first time ever, this week I’m trying to use Firefox and DuckDuckGo instead of Chrome and Google.

Update November 9, 2019: Yeah, that didn’t go so well. 😂

Malcolm Gladwell Talks About Puzzle Rush  

Malcolm never said “chess.com” in the episode, but here’s a fact: the only place you can play Puzzle Rush is at chess.com.

I’ve had the privilege to be a core developer on this project, and it was fun to hear a high-profile outsider’s take on the feature.

Sblack  

We’re all patiently waiting for Slack to introduce Dark Mode for its Mac app. Meanwhile though, Sblack is an interesting app if you’re looking for a way to have dark mode in a native Slack App.

The challenge with 3rd party dark mode support is that it constantly has to adjust to the HTML and CSS changes of the host DOM. I’m noticing that recent threaded replies have lost whatever customization they used to have, for instance. Little broken details like this keep someone like me from being able to use this, but your mileage will vary. It’s worth checking out.

Why Jason Fried Doesn’t Wear an Apple Watch  

Jason Fried:

I love mechanical watches for a number of reasons – the art, the science, the ingenuity behind the mechanisms, the continuation of a craft dating back centuries, the look, the feel, the freedom from batteries and tethers and cords.

But lately it’s really come down to this: When I look at my watch, it gives me the time. It asks nothing in return. It’s a loyal companion without demands.

This freedom from distraction is one of the reasons I’ve never bought an Apple Watch and continue to primarily wear leather-banded Fossils. Smartwatches are ubiquitous in my line of work, but Jason’s onto something.

Apple’s New 6k Monitor Is Not the Monitor for the Rest of Us  

If you’re regularly in a coworking space like I am, you want the non-glossy finish. So instead of the $5,000 one, you need the $6,000. And on top of that you need the stand, which sells separately for $1,000. So all totaled, you’re looking at $7,000 pre-tax. Where I live with a roughly 8.5% sales tax, that’s $7,600 total. To put things in perspective, that’s more than what I paid for the Honda Accord that I bought in 2012 and that I still drive to work every day.

This new monitor isn’t the monitor for the rest of us. It’s the monitor for the elite of the elite. And here I was thinking that LG’s 5K monitor was a splurge at $1,300. 🙄

My day-to-day monitor is a discontinued Dell 27” 4k Monitor. I bought it used from a friend for $200 earlier this year. It’s not as elegant as Apple’s aluminum Thunderbolt Display monitor of yore but it’s got a sharper display and (very importantly) it has a matte finish. Unless you want to see your face in a mirror all day, if you’re in a well-lit open office environment, you need a matte finish.

In a way, it’s a relief that Apple’s one and only standalone display is so ridiculously out of our price range. It keeps us from even being tempted. Still, this is bonkers. Nobody except those within rich Hollywood film studios (and similar) are going to buy this. In making the best monitor in the world, in settling for nothing except the best, Apple priced itself out. Apple made its accomplishment irrelevant. Meaningless. It would have been far better for Apple to offer an aluminum 27” 5K monitor that was “close enough,” and offer it at $1,000. That’s what the Steve Jobs Apple did with the Thunderbolt Display.

Don’t give me some nonsense about “Apple just doesn’t compete at those lower margins.” The 27” 5K iMac starts at $1,800. What I’m asking is that Apple take that computer body, gut the internals so it’s just a standalone monitor, and slash off $800.

Maybe they’ll still do that at some point in the future. But I’m not holding my breath.

Google Chrome Restricting Ad Blockers  

Tl;dr — Google is making it harder for ad blockers to block ads. If you worship the shrine of privacy, this will bother you. For the rest of us, it’s fine; Google Chrome remains the #1 browser with the most market share and the best developer toolset. Ads are how sites make money. Ads pay the bills. That’s the way it is. 🤷🏾‍

Virtual Dom Is Pure Overhead  

Great article by a core contributor to Svelte about why the pure DOM that’s offered in React and Vue and most every other modern JS framework is not all it’s cracked up to be. Both the clarity of the writing and the typography of the Svelte blog are a joy to behold.

I’ve gotten to the point where if I have a choice in a new project, I go with Svelte. Smaller bundle sizes and faster runtime outweigh its slightly more verbose syntax.

Why Light Modes Are Better for the Eyes  

Turns out, there’s scientific reasons backing up the argument that light modes (dark text on light backgrounds) are better than dark modes. We live in an an era in which websites, apps, and operating systems are trying hard to accommodate both. But they’re not created equal.

CSS-Only Async Chat  

Add this to the list of “using CSS for things that most people would say require JS.” This is one of those incredibly innovative things that you would never do unless you were truly resource-constrained and couldn’t use WebSocket and Ajax. But knowing that it is possible and how it’s possible is worth the read.

8-Digit Hexadecimals  

I’m not sure how I never knew about this, but you can specify transparency in a hexadecimal color in CSS. Keep in mind that IE 11 and Edge don’t support this yet, but you can get around that by using something like SCSS that then compiles this into a more compatible and recognizable rgba() output. Serious levels of Unobtanium, this.

Chrome 73 Brings Dark Mode Finally  

This looks so good. I refused to use a dark Chrome theme because I just couldn’t stomach the gradients. So I’ve gone from the native light mode to this native dark mode after many moons of waiting.1 The new breakpoint editor is also amazing.


  1. Ever since Dark Mode came out in Mojave last fall. ↩︎