Keith Schacht’s Blog

I'm one part inventor, one part explainer, and one part entrepreneur. I post regularly on YouTube, Instagram, and TikTok. I've started many... more

View tag Ruby 5 tui 1 startups 2 life-design 1 HostedGPT 1 ...

 

Recent

🔗 Async meetings (#).

I've long heard about the Amazon approach to meetings and have been intrigued. But people who have actually done it report mixed feelings to me. And the process is quite prescriptive and feels a bit heavy so I've yet to try it.

But this article did a really good job of articulating what I think might be the fundamental insight of Amazons meetings. And it proposes a variety of ways for implementing the basic insights so it's far less prescriptive:

#permalink 06/14/25, 7:02 pm / startups

📝 Setting up Android phone to work with Apple Watch and iMessage #

Here are the key steps I went through to my Android phone to work with iMessage and with my Apple Watch. This was all done on AT&T. I suspect it’s similar for all U.S. carriers but I haven’t tried it on any others. I first got my Apple Watch working, which wasn’t too bad, except I wanted full support for iMessages both on my watch and on my Android phone. That is the hard part, but the steps below walk through all of it:

  1. I had a newish iPhone, which did not have a physical SIM card that could be removed. The new phones use eSIMs, i.e. software SIM cards. So I went to Amazon and bought a cheap old iPhone for $177 to switch everything over to this phone.
  2. When I powered on this old iPhone, I went through the setup process as if it’s a brand new phone, and I transferred all of my data over from my existing iPhone (the one that has the eSIM). The one small surprise I had is that this old phone I bought was only 64 gigs, and the iPhone I’ve been using has a lot more storage usage than that. It took me a bit of time to decide what apps to delete and what data to remove. The reason that setting up this phone matters is because it will ensure that everything works smoothly with the Apple Watch, both in terms of watch apps and app notifications that I want to come to my watch.
  3. I took both iPhones into the AT&T store and asked them to transfer my number to this phone. It’s important to let them know that you want a physical SIM put into this phone. After transferring my phone number over and confirming it works, NumberSync stops working on the Apple Watch. So, while I was still in the AT&T store, I got their help making sure that the Apple Watch still worked to receive phone calls and texts.
  4. Now I was able to take the SIM card out of this new iPhone and pop it in the Android phone. I set up the Android phone completely and made sure calling and regular SMS were working. All of this went smoothly. Notably, after anywhere from 10 minutes to 24 hours, Apple’s servers will detect that there is no longer an active iPhone on the account and it will de-register your phone # from iMessage. You can tell this is the case if you try to text yourself from a friend’s iPhone. It will be clear you’re sending a green SMS text message. This is the key puzzle to solve.
  5. I took the new iPhone back into the AT&T store and let them know the phone had stopped working because the SIM card was removed. I asked to buy a new SIM card to put in this phone (it’s $5) and have them transfer that phone number over to the new SIM card. Be sure to open Settings > Apps > Messages, tap RCS Messaging and make sure RCS Messaging is enabled and that it does not show the text “Waiting for activation.” Wait until RCS is fully activated.
  6. While you are waiting, it’s worth making sure that iMessage is set up to sync with iCloud. Go to Settings > Your name > iCloud > and ensure Messages is On. You probably also want to make sure the Messages app is installed on your Mac and has fully synced all the messages from iCloud.
  7. This is where things get tricky: Make sure the RCS activation step above is completed. Now turn the iPhone on airplane mode (ensure wifi and cellular are both turned off). Remove the working SIM and put the non-working SIM card into the phone. When you to go Settings > Cellular you’ll see this non-working SIM card still knows what phone # it was assigned. Tap this number to edit it and remove the + from the front. It starts off looking like +1 (777) 777-7777 and you just edit it to be 1 (777) 777-7777. Now turn wifi back on but keep cellular off. Your Mac might show this as a new # being added to iMessage and ask you to approve.
  8. Now go to Settings > Apps > Messages > Send & Receive. It should show your phone # and your and iCloud email address. In the top section, “You can receive iMessages to and reply from.” there should be a spinner next to your phone number so you can’t select it (because the current SIM in your phone is not the active one). If you tap to try and select the phone #, it will warn you that you’re about to remove your phone # from iMessage. Do NOT do this. Simply leave your phone on this screen, with the spinner, overnight (so plug it into power). The next morning I looked at my phone and the spinner had stopped and the phone # was finally selectable. In the top section, select your phone and email. In the bottom section (Start new conversations from) I selected my phone. I have no idea why this spinner-waiting strategy works, but it’s been reported by multiple people online and it played out exactly as others reported.
  9. At this point, your Android phone is fully working for phone calls and SMS, and your Apple Watch and computer are fully working for iMessage. Now you need to get your iMessages over to your Android phone, and you do this with a special app and service called BlueBubbles.app. BlueBubbles is a special app you install on your Android phone and a special client you need to install on a Mac which has access to your iMessage. My main Mac is a portable notebook, so it’s not always turned on. So I rent a Mac from MacInCloud.com.
  10. Click to Customize their cheapest dedicated server ($59 per month). They let you pick the operating system to have installed and according to BlueBubbles FAQ (read What is the best macOS device and version to use?) they recommend Ventura. I kept all the other options at the least expensive.
  11. Once you get into the computer, be sure to login iCloud in the Mac settings and make sure your iMessage is working and that it’s fully synced to your account.
  12. Download and install the server for MacOS. There are a lot of steps to set up but their wizard did a pretty good job walking me through it.
  13. Lastly, install the BlueBubbles app on your Android, in settings it will ask for the same Google credentials that you provided during the BlueBubbles server setup. It all just worked and my messages appear, I can hold to send reactions to messages, I can be part of group iMessage conversations, etc!

🔗 Web Components Tutorial (#). A great tutorial on using web components.

#permalink 05/17/25, 8:23 pm

💡 TIL: with_defaults is a better named alias #

`with_defaults` is the same as `reverse_merge` in rails but much better named.

💡 TIL: Bundler can be configured to auto install #

No more pulling down changes to a project and realizing I need to run `bundle install`. Run this command once on a dev machine and it’ll auto install whenever new gems are needed: `bundle config --global auto_install true`.

💡 TIL: React in Rails is gaining momentum with Inertia #

I am seeing more activity around an elegant way to utilize React in Rails. I plan to try this out soon and these articles are a good starting point. There is even a shadcn starter project which is part of my motivation.

📝 Query optimization in rails #

It’s been awhile since I’ve gone deep on optimizing queries in rails. Over the years I’ve settled into two default approaches: (1) drop into raw SQL and write CTEs that help get a clean set of the final activerecord objects I’m looking for, or (2) add various cache columns to tables such as last_comment_id to greatly simplify the SQL.

I came across this discussion online that did a great job of surveying a whole range of approaches including some new ones I have never tried. This article offered a great summary of the options and I learned Rails now supports CTEs natively.

🔗 A clever CSS-only hack for blurry placeholder images (#). This little bit of code, gives you a nice blurry placeholder with no JS required:

<img src="…" style="--lqip:192900">

#permalink 04/06/25, 10:18 pm

🔗 How to import any JS library without a build system (#). I often come across an NPM module and want to import it into an app I’m building which does not make use of a javascript build. It’s quite tricky! This article breaks down the complete set of options for doing this. And when that fails we can bundle a single NPM module.

#permalink 03/31/25, 8:12 pm

🔗 Updating a rails view component with hotwire (#). This is a good pattern for wrapping a rails view partial with a light class to enable more easily updating them with Hotwire.

#permalink 03/04/25, 2:39 pm / Rails

💡 TIL: Ruby’s clamp method reduces conditionals #

You can constrain a variable to be within a range using clamp:

5.clamp(1, 10)  # => 5
-3.clamp(1, 10) # => 1
15.clamp(1, 10) # => 10

💡 TIL: Regex within string square brackets #

I’ve always known that Ruby supports ranges within a string’s square brackets. So in addition to the simple `name[4]` I can do `name[2..4]` and `name[2...]` and `name[-1]`. But I just learned you can put regex in the square brackets for more dynamic substring selectors: `“me+abc123@email.com”[/.+\+(.+)@(.+)/, 2]` will give you the subdomain of the email address. It even works with named capture groups! `“123.45”[/(?<dollars>\d+)\.(?<centers>\d+)/, :dollars]` will give you the dollars. The article has a few other notable examples.

via

💡 TIL: Elegant solution to versioning an API #

The couple times I’ve done API versioning it was with /v1/ or v1.domain.com. Both of these are the generally recommended pattern within rails. This article outlines a querystring based approach to API versioning and a much more flexible implementation strategy that avoids a lot of duplication and code maintenance.

via

🔗 A programmable wireless eink display (#). This is a clever little product: it’s an eink display that is fully programmable and you can wirelessly update. I’m sure I could use this for a future project.

#permalink 02/24/25, 3 pm / gadgets

🔗 Dynamic routing to a controller’s action (#). If you have a rails form which has multiple submit buttons such as Publish and Unpublish, you can easily route those to corresponding actions within the controller with this clever hack.

#permalink 02/24/25, 2:49 pm / Rails

💬 from Dario’s interview with Lex Friedman (via) #

Dario from Anthropic is the most articulate and thoughtful person I’ve found on the subject of AI. In this interview he made a fantastic point I had not heard:

Let’s say it was 1995 and Moore’s Law was making computers faster and everyone was saying, “some day we’ll have super computers and we’ll be able to sequence the genome and do all these great things.” But there is no discrete point where we pass a threshold and then have super computers.

Super computers is a term we use but it’s a vague term we use to describe computers which are a lot faster than what we have today. I feel the same way about AGI. There is a smooth exponential. And if, by AGI, you mean AI is getting better and better and will do more and more of what humans do until it’s smarter than humans and it will continue to get smarter from there, then I believe in AGI. But if AGI is some discrete thing, which is how many people talk about it, then it’s just a meaningless buzzword.

But he then goes on to reference his essay in which he gives one of the best descriptions of an almost discrete point I’ve read! He doesn’t call this AGI but instead uses a great descriptor:a country of geniuses in a datacenter:

In terms of pure intelligence4, it is smarter than a Nobel Prize winner across most relevant fields – biology, programming, math, engineering, writing, etc. This means it can prove unsolved mathematical theorems, write extremely good novels, write difficult codebases from scratch, etc.

In addition to just being a “smart thing you talk to”, it has all the “interfaces” available to a human working virtually, including text, audio, video, mouse and keyboard control, and internet access. It can engage in any actions, communications, or remote operations enabled by this interface, including taking actions on the internet, taking or giving directions to humans, ordering materials, directing experiments, watching videos, making videos, and so on. It does all of these tasks with, again, a skill exceeding that of the most capable humans in the world.

It does not just passively answer questions; instead, it can be given tasks that take hours, days, or weeks to complete, and then goes off and does those tasks autonomously, in the way a smart employee would, asking for clarification as necessary.

It does not have a physical embodiment (other than living on a computer screen), but it can control existing physical tools, robots, or laboratory equipment through a computer; in theory it could even design robots or equipment for itself to use. The resources used to train the model can be repurposed to run millions of instances of it (this matches projected cluster sizes by ~2027), and the model can absorb information and generate actions at roughly 10x-100x human speed5. It may however be limited by the response time of the physical world or of software it interacts with.

Each of these million copies can act independently on unrelated tasks, or if needed can all work together in the same way humans would collaborate, perhaps with different subpopulations fine-tuned to be especially good at particular tasks.

#permalink 02/09/25, 10:34 pm / AI

🔗 Campsite Rails codebase (#). There are not a lot of great open source rails projects to learn from, but lately I’ve seen some notable discussion about this one. I’m bookmarking it so I remember to dig in at some point and see what I learn.

#permalink 01/20/25, 10:38 pm / Rails

🔗 Avo—Rails Admin (#). There are a few different gems for building Rails internal admin dashboards. Next time I build one I want to do a deep dive and see if I like any of them. This is a new one I came across that looks interesting.

#permalink 01/20/25, 10:36 pm / Rails

🔗 YouTube: Death Spiral of Army Ants (via Gurwinder) #

A phenomenon where army ants follow each other in circles, sometimes until they die — and thus known as an “ant death spiral” — was captured on camera at a university in Venezuela. Biologist Javier David Uzcategui Gonzalez filmed the footage at Simon Bolivar University in Miranda, describing the occurrence as “very rare”. In an August 2020 tweet, Gonzales explained that the phenomenon, also called an ant mill, will happen when some ants lose track of the colony and follow others “in a rotating circle of death.”

#permalink 01/07/25, 7:15 pm / hook

💬 from Gurwinder (via) #

The best way to learn something is to try to teach it to others. The sense of responsibility to your student motivates you to understand a topic, and the act of explaining something helps you to connect the dots and commit them to memory.

#permalink 01/07/25, 7:09 pm / explanation

🔗 Study: Waymo robocars are safer than human drivers (via Daniel Miessler) # An insurance company reported that Waymo has logged 25 mmillion fully autonomous miles and showed a 88% reduction in property damage claims and a 92% reduction in bodily injury claims. In other words, if humans had driven these same miles there would have been 8x as many property damage claims and 13x as many bodily injury claims.

#permalink 01/07/25, 6:59 pm / AI

🔗 CIA robot dragonfly spy device (via Daniel Miessler) # In the 1970s the CIA built a tiny robot dragonfly listening device that could fly 200 meters in a few seconds to eavesdrop on conversations. It used a gas-powered fluidic oscillator to flap its wings 1,800 times per minute and could be controlled by an infrared laser beam. They claim the device was never used for a mission because it struggled with crosswinds above 7mph.

At this link, the second video shows flight tests of the device.

#permalink 01/07/25, 6:55 pm

💡 TIL: pick is the single-value version of pluck in Rails #

Instead of doing

Messages.pluck(:user_id).first
you can do
Messages.pick(:user_id)

💡 TIL: Rails ActiveRecord has a .sole method #

I just learned about `sole` and `find_sole_by`. They ensure that only a single record is returned and will raise if there is something other than one. It’s the equivalent of:

api_keys = user.api_keys.where(key: key)

if api_keys.length == 1
  api_key = api_keys.first
elsif api_keys.length == 0
  raise "No records found!"
else
  raise "More than one matching record found!"
end

🔗 Rails web-based database admin (#). A rails gem that gives you a web-based interface to your database.

#permalink 11/26/24, 4:15 pm / Rails

🔗 Vampire game based around AI voice: SUCK UP! (#) This is one of the best examples I’ve seen of games creatively incorporating LLMs. You are a vampire character, you walk up to houses in a neighborhood and as the player you actually talk aloud to your computer and the NPCs talk back. You have to convince these NPCs to let you into their house.

#permalink 11/26/24, 3:47 pm / AI

💡 TIL: NASA’s Dragonfly probe to Saturn’s Titan in 2028 #

In 2028 NASA is launching a spacecraft to Saturn’s moon Titan to study its habitability in a mission named Dragonfly. It will land in 2034. They’re sending a drone powered by a radioisotope thermoelectric generator so they can visit a variety of sites. Titan is notable because it’s believed to have a similar chemistry to ancient earth. Past probes have measured the contents of the atmosphere and confirmed it contains a mix of hydrocarbons. The surface contains a lot of water ice and scientists believe there is a water ocean in the interior of the moon.

🔗 The first state-of-the-art coding LLM that runs locally (#). This Qwen2.5-Coder-32B should run locally in about 20-30 gb of ram and assessments show it to be better than 4o at coding but not quite as good as Claude 3.5.

#permalink 11/13/24, 5:32 pm

🔗 Jina AI tool for simplifying webpages (#). This is a really handy tool for simplify a webpage before passing it into an LLM. It turns HTML into semi-structured markdown.

#permalink 11/03/24, 8:49 pm / AI

🔗 Using LLM to process video (#). I have done a lot of experimenting with passing screenshots into an LLM to give it additional context, but I really want to try passing video directly into the LLM. I believe Gemini is the only one that supports it. This is a summary of Simon Willison’s recent experiment with Gemini for video.

#permalink 11/03/24, 8:11 pm / AI

Highlights