Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
SplitDuck.com Use A/B testing to increase revenue
1

TIL: Detaching Action Text Images

from Good Enough [alt+shift+b] in technology

A Pika author was editing the same post in two browsers. They added six images in Browser A, then later they referenced an old tab editing the post in Browser B. That copy of the editor did not include those images. Browser B saved and removed all six images from Active Storage. A short time later, Browser A saved its newer copy of the post and put the image references back, but at that point the originally uploaded files were gone due to Browser B saving the post without the images. This exposed two separate problems: Missing images produced uncached 404 responses that the editor requested repeatedly. Action Text purged an image as soon as one save removed it from the body. Here’s how we fixed those problems. Why Action Text deleted the images Action Text keeps a rich text record’s embeds synchronized with the attachments in its body. When a submitted body no longer contains an image, Action Text removes its ActiveStorage::Attachment. Active Storage then purges the dependent blob, deleting both its database record and its file. That behavior makes sense when there is only one current copy of a document. It is unsafe when the same post can be open in multiple tabs, browsers, or devices. One stale save can delete an image that another editor is still using. Why the missing images flooded the server Browser A still had the six images in its editor, each pointing at an Active Storage redirect URL: /rails/active_storage/blobs/redirect/:signed_id/:filename Pika uses the ProseMirror-based Rhino editor. Rhino rebuilt an image’s DOM node when its caption or selection changed. Each new <img> element requested its URL again. Healthy images did not cause trouble since Active Storage makes its redirect cacheable. For a purged blob, Rails returned a 404 without Cache-Control, so the browser kept sending the request to Rails instead of reusing the failure. In a gallery, typing could re-request several missing images per keystroke. In these scenarios, this issue led to...
4 weeks ago

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Good Enough

Album Listening in Album Whale

Back in March we added Album Search in Album Whale. This was a very nice update because it meant you no longer had to first grab an album share link from a music service (e.g. Spotify, Apple Music, Bandcamp, etc) in order to save an album to a list. You can just head straight to Album Whale and do it all there. Today we’ve added another feature to Album Whale with a similar goal in mind, this time on the other end of the spectrum: now you can listen to an album right in Album Whale! No more needing to jump over to a music service first to do so. Hover over any album artwork and you’ll find a green ▶︎ play button, which opens a dialog containing music service embeds for that album, like this: While amazing for discovering new music quickly, I’ve also found it very useful for my own To Try list. Now this entire flow can happen within Album Whale after hearing of a new album I want to listen to at some point: Add it to my To Try list in Album Whale using search Listen to it right in Album Whale If I like it, copy it to another list in Album Whale (oh ya, this is another small feature we added!) A couple more notes: For albums added to Album Whale using a Bandcamp share link, those green play buttons just link back to Bandcamp. At least for Spotify, I found I needed to be logged into Spotify on the web to have their embeds in Album Whale play the whole album, not just a preview. This might also be true for other music services. We hope you discover many great new tunes this summer! Listen on Album Whale Reply by email

4th Aug 2026 • 1 votes
How to: Adding a floating “Back to top” button in Pika

As we say repeatedly on its homepage, Pika is designed to help you focus on writing, not tinkering with your blog design. To that end Pika purposely doesn’t support complex liquid templating or other such code customization. However, today I thought I’d share how crazy powerful custom CSS can be in some circumstances where you want to augment Pika. Pika has a “Scroll to top” button floating in the bottom right of the Dashboard. Some people have asked if they can have this on their own blog. This may or may not be a feature we build right into Pika one day, but in the meantime, you can get close to a full implementation yourself in Pika. Here’s how: First, head to Pika’s Settings, scroll down to Site footer and add this to the bottom of the site footer editor: ↑ — This is an up arrow that is linking to #top, which will now be on every page of your Pika site. After saving that, head to Settings > Theme, scroll down to Additional options and check “Add custom CSS”. In the resulting code editor that appears, let’s add some CSS that targets that specific link, and designs it as a floating button: .user-site-footer a[href="#top"] { /* Float this in the bottom right of the page */ position: fixed; bottom: var(--space-S); right: var(--space-S); z-index: 1; /* Centered styling */ display: grid; place-content: center; /* Button styling with built-in Pika style variables */ background-color: var(--color-primary); border-radius: var(--radius-round); color: var(--color-txt-on-primary); font-family: var(--font-family); font-size: var(--font-L); height: var(--space-XL); width: var(--space-XL); text-decoration: none; } Depending on if you have other custom CSS, you might need to add !important to any of the style lines above. That’s it! Now you have a floating back to top button on your Pika blog, designed to look like other buttons on your site. But if you want to go the extra mile, here’s how you would make it so the back to top button only shows up after scrolling a bit (since it’s not so useful when you’re already at the top of the page): .user-site-footer a[href="#top"] { /* Float this in the bottom right of the page */ position: fixed; bottom: var(--space-S); right: var(--space-S); z-index: 1; /* Centered styling */ display: grid; place-content: center; /* Button styling with built-in Pika style variables */ background-color: var(--color-primary); border-radius: var(--radius-round); color: var(--color-txt-on-primary); font-family: var(--font-family); font-size: var(--font-L); height: var(--space-XL); width: var(--space-XL); text-decoration: none; /* Hide it until a little bit of page scroll */ transition: 200ms; opacity: 0; pointer-events: none; } .scrolled-a-bit .user-site-footer a[href="#top"] { opacity: 1; pointer-events: all; } Feel free to make this button your own, like adding a box-shadow (since it’s floating), or making it a rounded square, or whatever you’d like. If you’re really clever, you could probably get the button to say “Scroll to top” when you hover on it, though that would take quite a bit more HTML and CSS — but it’s possible! I leave that as an exercise for you. Reply by email

22nd May 2026 • 1 votes
Album Search in Album Whale

Did you know that we, Good Enough, make a little website called Album Whale where you can make beautiful lists of albums to share with your friends, the world, or just yourself? It’s true! We haven’t made an update there in quite some time (it’s pretty good enough as-is), but I was inspired this week. Adding an album to a list previously required you to first grab an album share link from a music service of your choice (e.g. Spotify, Apple Music, Bandcamp, etc). This has always been a bit cumbersome. I’m excited to share you can now just search for an album right away in Album Whale! Like this: 🔍 💿 🎉 No need to first go somewhere else, you can jump right to Album Whale when you want to save an album to a list. I’ve found this really made my private “To Try” list more useful. Behind-the-scenes we’re using MusicFetch, which supports most of the big music services. We aren’t sure, but there may be some albums that aren’t found via search? If so you can still paste in a link as you always could. Reply by email

24th Mar 2026 • 1 votes
How We Configure Our Rails Local CI

Continuous integration is a great thing, and having tests and security checks run before every deploy is also a great thing. But if you’re a developer who has been shipping production code for more than a week, you definitely understand how much it can all feel like a house of cards that tumbles down nearly every day. The Good Enough suite of products have been using GitHub Actions to make sure our automated test suites run before each deployment. The (mostly free) servers GitHub offers are predictably slow, with the Pika test suite generally taking close to ten minutes to run. (To that you say, “Delete most of your system tests!” Alas, due to Pika’s lovely editor, we unfortunately have to maintain quite a few system tests for the service.) Even when upgrading, and paying for, a higher-strength GitHub Action server we were seeing runs approaching eight minutes for Pika. That’s already no fun, but even worse is the fact that our system tests were a bit flaky in the GitHub Actions environment. We eventually got the hint that running system tests in parallel just isn’t possible, but even running them one test at a time would lead to odd failures in part because of how slow things  move in the Actions environment. So imagine the cycle of trying to deploy a Pika update and needing to run continuous integration two, three, or four times. Frustration! There’s got to be a better way! There is. Hopefully. With the arrival of Rails 8.1 came the option to set up local CI. As a team of two wanting to move a little more quickly and with a little less frustration, this seems like a perfect fit. Here’s how I’ve set it up for Pika… ci.rb: # Run using bin/ci CI.run do step "Setup", "bin/setup --skip-server" step "Security: Gem audit", "bin/bundler-audit" step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error --confidence-level 2" step "Security: Importmap vulnerability audit", "bin/importmap audit" step "Tests: Rails", "bin/rails test" step "Tests: System", "bin/rails test:system" step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant" # Set a green GitHub commit status to unblock PR merge. # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`. if success? step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff" else failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again." end end In order for the importmap vulnerability audit to run successfully, I needed to update our gemfile with openssl: group :development, :test do gem "openssl" end Here’s an excerpt of Pika’s application_system_test_case.rb: ENV["PARALLEL_WORKERS"] ||= "1" # System tests seem less flakey when not run in parallel require "test_helper" class ApplicationSystemTestCase < ActionDispatch::SystemTestCase browser_options = Selenium::WebDriver::Chrome::Options.new.tap do |opts| opts.add_argument("--window-size=1200,800") opts.add_argument("--disable-extensions") # Disable non-foreground tabs from getting a lower process priority opts.add_argument("--disable-renderer-backgrounding") # Normally, Chrome will treat a 'foreground' tab instead as backgrounded if the surrounding # window is occluded (aka visually covered) by another window. This flag disables that. opts.add_argument("--disable-backgrounding-occluded-windows") # Suppress all permission prompts by automatically denying them. opts.add_argument("--deny-permission-prompts") opts.add_argument("--enable-automation") end Capybara.register_driver :chrome_headless do |app| browser_options.add_argument("--headless") Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options) end Capybara.register_driver :chrome do |app| Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options) end if ENV["SYSTEM_TESTS_BROWSER"] driven_by :chrome, screen_size: [ 1200, 1000 ] else driven_by :chrome_headless, screen_size: [ 1200, 1000 ] end end Prerequisites to run local CI: brew install gh gh auth login gh extension install basecamp/gh-signoff Run: gh signoff install This installs the GitHub command-line interface, installs the signoff extension for GitHub command-line, and turns on the signoff requirement in your repo. Here’s the process: Get all your changes pushed to a branch and make a PR Make sure your local environment doesn’t have any lingering file changes or CI will fail Run bin/ci Upon successful completion of local CI, signoff will land on your branch, and you can merge and push to main. If you ever need to move quickly, say in an emergency situation: > gh signoff create -f > git push Since Lettini and I are both super-duper admins in our GitHub account, we needed one more update to protect us from willy-nilly pushing to main. I had to update a setting on GitHub in each repository. I clicked on Do not allow bypassing the above settings in repo > branches > Branch protection rules > main > edit: It’s not all rainbows and unicorns In an ideal world, hands-off CI is a really great thing. It will take a bit for these steps to become muscle memory. I hope they do! System tests are still notoriously flaky, but running tests only in our local environments means we shouldn’t have to account for both general flakiness and super-slow-test-running flakiness. GitHub has a useful feature called Dependabot, which can apply security updates to your dependencies and create a pull request that’s often ready to merge. Sometimes we’ve just clicked that merge button in the past, feeling confident because our test suite had already run in GitHub Actions. Now we’ll have to pull down those branches to go through a local CI and signoff step in order to merge things. If local CI doesn’t end up fitting us, I’ve also discovered there are faster, GitHub-Action-based alternatives for automating CI, such as Blacksmith. These services also have historically been cheaper than increasing server power at GitHub, though recent policy changes at GitHub have changed that math. And a thank you I’d be remiss if I didn’t thank 37signals for opening up their Fizzy repository. This helped me to really streamline our application_system_test_case.rb, which had become a Frankenstein’s monster of a thing as I troubleshot system test issues over the years.

9th Jan 2026 • 1 votes

More in technology

Java and JavaScript are similar, actually

I am here to perform the forbidden comparison. Everyone says that JavaScript has nothing to do with Java, even though their names are similar: “The two languages are entirely distinct.” “Java is to JavaScript as ham is to hamster.” JavaScript’s name was “an attempt to piggyback on the popularity of Java, an entirely unrelated language.” This long-held belief is, in my opinion, inaccurate. Java and JavaScript have a lot in common. Wake up to the truth!!! They have similar syntax According to JavaScript’s creator, “the diktat from upper engineering management was that the language must ’look like Java’.” This happened! JavaScript looks like Java! A lot of code works identically in the two languages. Comments are identical: // Single-line comments are the same. /** Block comments are also the same. */ Many expressions work the exact same way: "Hello world" 12 + 34 true && false myObject.myMethod(1, 2, 3); Conditionals are also identical: if (coinflip()) { return "heads"; } else { return "tails"; } Variable declaration can be the same. This line works in both languages: var foo = "bar"; Many code snippets aren’t identical, but they’re similar. And they’re even more similar if you put TypeScript in the mix: Java TypeScript for (var age : ages) {   System.out.println(age); } for (const age of ages) {   console.log(age); } class Person {   private String name;   public Person(String name) {     this.name = name;   }   public String getName() {     return name;   } } class Person {   private name: string;   constructor(name: string) {     this.name = name;   }   public getName(): string {     return this.name;   } } list.stream()   .filter(x -> x > 5)   .map(x -> x * 2)   .collect(Collectors.toList()); list   .filter(x => x > 5)   .map(x => x * 2); Many programming languages share C’s syntax—you’ll see these similarities with other languages, too—but the connections run deeper. Their type systems are similar I know what you’re thinking: Java has a static type system, and JavaScript does not. But! TypeScript augments JavaScript with static types, and is the de facto way to write modern JS. So yes—JavaScript doesn’t technically have static types, but it does in practice. Even without static typing, their type systems have many other similarities. They use primitive and reference types According to the Java spec, “There are two kinds of types in the Java programming language: primitive types and reference types.” This is exactly the same as JavaScript. Both languages also have wrappers around primitive types. Though the specific types are different, the behavior is similar. They have (auto)boxing In Java, you can have a primitive type or an object wrapper around one. Converting a primitive type to a wrapper type is called “boxing”. // Java var primitive = 123; var reference = Integer.valueOf(123); JavaScript also has primitive values and explicit wrapper objects: // JavaScript const primitive = 123; const reference = new Number(123); You often encounter these wrapper objects through “autoboxing”. Autoboxing implicitly converts primitives to objects. The conversion contexts and semantics differ, but they both work similarly: // Java var primitive = true; Boolean reference = primitive; // Autoboxing happens here. reference.toString(); // JavaScript const primitive = true; primitive.toString(); // Autoboxing happens here. Strings use UTF-16 and share methods Strings work very similarly in both languages. In addition to being immutable in both, they have a number of similar methods: .toUpperCase(), .toLowerCase(), .substring(), .indexOf(), .split(), and many more. They also both use UTF-16, so they have weird behavior like this: // In JavaScript... "🌸".length; // => 2 // In Java... "🌸".length(); // => 2 (For more on UTF-16, see “Why does ‘👩🏾‍🌾’ have a length of 7 in JavaScript?”.) If you know how to use strings in one language, you probably know how to use them in the other. They’re really not that different. Numbers and Math are similar, too Java has a bunch of numeric primitives where JavaScript only has the number type. (JS also has bigint, which is rarely used.) But Java’s double and JavaScript’s number are both 64-bit IEEE 754 floating-point values: // Java or JavaScript (identical) 0.1 + 0.2 // => 0.30000000000000004 Their Math APIs are also very similar: Math.max(3, 7); // => 7 Math.sqrt(81); // => 9 Math.PI; // => 3.141592653589793 They both have classes and inheritance Though Java is the Kingdom of Nouns, both languages support classes and inheritance: class syntax, constructors, instance and static members, new, this, extends, super, and method overrides. TypeScript adds even more similarity with abstract classes, implements, and private/public access modifiers. Their internals are different, but you can ignore that most of the time. If you know how classes work in Java, you can probably apply that to JavaScript, or vice versa. They have similar runtimes The two languages’ runtimes also have a lot in common: Garbage collection: Neither the programmer nor compiler deallocates memory. This is in contrast to languages like C, Rust, and Swift, which have different memory management strategies. Just-in-time (JIT) compiled: Mainstream engines compile hot paths to native machine code. Fairly ubiquitous: I think Java fell short of its “write once, run anywhere” slogan. But I can’t deny that the JVM is widely available and powers a massive number of computer systems—just like JavaScript. Compile targets for other languages: There are a number of JVM languages like Clojure, Kotlin, and Scala. JavaScript’s most popular counterpart is probably TypeScript, but there are others like PureScript and ReScript. The languages have been separated from their runtimes, at least somewhat. They have DOM support (!!) I came across a package called org.w3c.dom when researching this post. It turns out that Java also supports Document Object Model APIs, just like JavaScript does in the browser. Here’s some code that is identical in both languages: // Add a new <li> element to the first <ul>. var ul = document.getElementsByTagName("ul").item(0); var li = document.createElement("li"); li.appendChild(document.createTextNode("wake up sheeple")); ul.appendChild(li); This surprised me! I know that JavaScript is the language of the web, but it turns out that Java is competitive! They have improved a lot in the last decade I don’t know what’s more popular: hating on JavaScript or hating on Java. (Another similarity!) But many of these haters last used the language in the early 2000s, when these languages were, broadly speaking, pretty bad. They’re way better now! In JavaScript, we got classes, modules, a big package registry, a bigger standard library, and better versions of common constructs like variable and function declarations. In Java, we got var, records, text blocks, pattern matching and switch expressions, and virtual threads. If you dislike these languages but you haven’t tried them recently, you might be pleasantly surprised. You’ll almost certainly acknowledge that they’ve improved (even if you’re still a hater). Wake up to the truth!!! I understand the benefit of saying things like, “Java and JavaScript have nothing in common.” Many of us have been approached by someone (well-meaning, usually) who doesn’t know the difference, and it causes some confusion. But these languages are actually pretty similar! Certainly a lot more similar than C and C#, in my opinion. I think it’s inaccurate to say “Java is to JavaScript as ham is to hamster.” My suggestion: Java is to JavaScript as the guitar is like the bass guitar.

10 hours ago • 1 votes
RIP Warren Buffett

In his last Thanksgiving message, Warren chose to emphasize just one thought: kindness – offered when it is not owed, with nothing expected in return. Kindness, he wrote, “compounds, and at a better rate than anything Charlie and I ever bought.” He was writing about his own teachers, and about everything they had given him … Continue reading RIP Warren Buffett →

13 hours ago • 1 votes
Only a good guy with an AI can stop a bad guy with an AI (Odds and Ends #113)

Plus what I thought of Ocarina of Time, and science communicators denying... science.

19 hours ago • 1 votes
Build and manage IoT projects with AI using the Arduino Cloud MCP

Setting up a remote monitoring and control project means choosing variables linking dashboard widgets, and deciding how to keep track of your device. Expanding an existing project might mean making the same change across dozens of sensors. In either case, you have a goal in mind – and a series of steps to get there. […] The post Build and manage IoT projects with AI using the Arduino Cloud MCP appeared first on Arduino Blog.

yesterday • 1 votes
The Path to Outlawing Parasitic Advertising

The viral question deserved answers. Here they are, objection by objection.

yesterday • 1 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in