justin․searls․co

Feels weird knowing—100%, not a doubt in my mind, knowing—that humanity will have cured cancer before it creates a system that can autonomously maintain an accurate inventory of the food available in one's kitchen.

Making a nice 2FA / OTP / SMS field with Tailwind & Stimulus

So, I built this little bit of UI today as part of an email-based authentication flow for Becky's new app:

(I haven't shipped this yet and I'm too lazy to record a screencast, so just imagine that this field behaves perfectly, please and thank you.)

If you, like me, have ever found yourself in the thrall of a beautiful-looking 6-digit form when logging into some site, whether when filling a TOTP from your authenticator app or copy-pasting a code that's been texted or e-mailed to you, you've probably wondered "how'd they make that field look nice like that?"

Well, today I actually started digging into it, and I didn't like what I found. At all.

But wait, there's more…

Epic Inbox Zero

I am generally extremely on top of my inbox, but I don't know if I can get through 18 quintillion e-mails by end-of-day.

Just realized it's much more acceptable to say I'm too busy writing to have time for reading than it is to admit I'm too busy talking to have time for listening.

Nice set of reminders on how to validate e-mail addresses in Rails models and was glad to find his second example to be almost identical to what I found in my newest app:

class User < ApplicationRecord
  validates :email,
    format: { with: URI::MailTo::EMAIL_REGEXP },
    presence: true,
    uniqueness: { case_insensitive: true }
end

One thing I'd be sure to add, though, is the new normalizes class method to ensure all email addresses saved by your app are easily compared by stripping whitespace and lower-casing them. From my User class:

normalizes :email, with: ->(email) { email.strip.downcase }

Never hurts to revisit the stuff you wrote on the first day of an app's life.

"It is currently estimated that new models with significant changes to the Vision Pro specification may not be in mass production until 2027," Kuo said today.

This makes me glad I bought at launch as opposed to waiting, and even more glad I opted for monthly AppleCare payments as opposed to buying the fixed two-year contract.

Until yesterday, I had never heard anyone but me in the Ruby community express confusion over the fact that Rails produced both paper_trail the audit log gem and Papertrail the logging SaaS.

But seriously, how the hell did everyone else keep these straight in conversation? (My bet is that they didn't, actually)

Breaking Change artwork

v6 - Pausing doesn't pause

Breaking Change

[UPDATE: In this episode, I referenced Stripe having an IPO in the past tense. I was mistaken, they are not (yet) publicly traded. We regret the error.]

The audio is better this week! I'm learning.

Also, I finally had something to talk about that has nothing to do with Apple! The target of the ion cannon that is my mouth this time? drumroll… it's Stripe! Sorry, Stripe. If you like rants about software quality and the systemic reasons everything is terrible, hoo boy! This one brings the heat. 🔥🔥🔥

We're starting to work down our mailbag backlog, so help me freshen it up by e-mailing the show at podcast@searls.co and our dedicated staff (me) will read it and—potentially, maybe—respond on the air!

And now, some URLs:

Show those show notes…

One of the most valuable things about writing automated tests is that they force you to run your code very many times in very many ways.

It's important to understand this is not a value of testing per se, though, and that there are other valid ways to achieve the same goal.

Captchas have really gotten away from us

Thanks to recent advancements in AI, the only way to pass this captcha and prove you're a human is to mutter, "what the fuck are we even doing here anymore," into your device's microphone.

Two decades as a programmer hasn't made me any better at estimating how long it'll take me to write software, but it's made me MUCH better at estimating how long other things will take. I'm a master at intuitively timing multiple dishes to finish simultaneously, for example.

In hindsight, I think I may have spent a large number of years misdiagnosing myself as having a push notification management problem when I actually had a "too many people in my life" problem.

What's a framework feature you probably ought to use but you nevertheless avoid?

For me, it's file generators. I can barely remember why, but with the sole exception of database migrations I never take advantage of any of Rails' generator commands.

A lot of people are surprised Vision Pro's field-of-view is so narrow, but it makes sense if you think about it: even if Apple invents all the technologies needed to release a Vision product in an eyeglass form factor, it'll never be much wider than 90º.

Apple's resistance to proper VR features suggests they don't want us getting used to anything that wouldn't be possible in their ideal version of the product.

Better 404 design

There are exactly three things I want from a 404 page:

  1. Something approaching an apology
  2. An easy way to report the broken link
  3. Copy that might elicit a sensible chuckle

This page only took a few minutes to make. The "let us know" link pre-populates the entire e-mail and is implemented in a Rails view thanks to a helper method that makes constructing mail_to links a little nicer:

def mail_to_url(email, **options)
  "mailto:#{email}?" + options.map { |k, v|
    "#{k}=#{ERB::Util.url_encode(v)}"
  }.join("&")
end
<%= link_to "let us know", mail_to_url("support@betterwithbecky.com",
  subject: "I got a 404!",
  body: "I clicked a link that led me here, but got a 404 message:\n\n#{request.url}"
) %>

Wish people spent more time sweating details like this.

Breaking Change artwork

v5 - Regressive Web Apps

Breaking Change

Welcome to Breaking Change, the 14th most popular technology podcast in Argentina! (And 30th in Norway!)

It's been a couple weeks since my last breaking change and, guess what, I done broke things again.

If you would prefer I not make so many breaking changes (or if you wish me to break even more of them!), e-mail me at podcast@searls.co and let me know and/or share your darkest secrets under a pseudonym using a throwaway account. Nobody needs to know.

Links and so forth:

Show those show notes…