Programming
-
Tally All Git Trailers in a Repository
I’ve been using a lot of Git Trailers in my commit messages recently and as my thinking on which trailer keys to use has evolved, it’s been useful to look back at which ones have been used before.
-
Prevent Mastodon and Bluesky from Generating POSSE Link Previews
Yesterday I posted that I’d resolved my new microblog POSSE1 posts from generating link previews on Mastodon and Bluesky. Today, I want to briefly run through how I managed that.
-
Tell GitHub to Render Markdown Pages with .gitattributes
Articles on Hearthside are written in Markdown (GitHub-flavored), but the file extension is
.md.yamlas they also make use of Jekyll-style front matter. My Frontmatter gem requires that files it handles end in.yamlor.yml, so this is necessary. -
Oxtail, and more Cooklang Exploration
After yesterday’s post, it was time to finally try to handle a blog post and Cooklang recipe in one file. The solution to how to format things was simple: inline the recipe in a Markdown code fence and pre-process it.
-
How I Model SwiftUI Views
The approach I take to defining ViewModels for SwiftUI was heavily inspired by Paul Hudson’s post Introducing MVVM into your SwiftUI project. In it, he advocates for defining
class ViewModelinside an extension to the relevant view. By naming each view’s MVVM classViewModel, it can always be... -
Truncate Date to Calendar.Component in Swift
I’m frequently wanting to work with truncated dates in Swift apps, especially when dealing with Swift Charts. Foundation provides
Calendar.startOfDay(for:)to get the first moment of a day, and that’s been really useful. The extension below will do something similar for an arbitrary1... -
Using Starship for the Same Prompt, but Faster
Starship is a highly-configurable, cross-shell prompt. I recently switched to using it and it sped up my prompt rendering from being noticably slow and taking probably half a second to render to an imperceptible 0.03s rendering time. It actually does slightly more than my old prompt did as well...
-
Send a From Header When You Crawl
Sending a From header is part of building a polite crawler, along with respecting Robots.txt and sending a unique User-Agent. The From header simply contains an email address that can be used by the site’s owner to reach out if your bot is creating any issues for them.
-
Search and Sync Your Shell History With Atuin
Atuin is a tool and labor of love built by Ellie Huxtable that runs in the background to capture commands you’ve entered. It stores these locally in a SQLite database and provides a great CLI tool to search through that history, provide stats of what commands you frequently run, and optionally...
-
Decryption/CypherError on Rails 7.1 Apps with Encrypted Columns After Upgrading from Previous Versions
When upgrading to Rails 7.1 with any models using the
encryptsmacro fromActiveRecord::Encryption, be wary of upgrading theconfig.load_defaultsinconfig/application.rbfrom7.0to7.1. The 7.1 defaults forActiveRecord::Encryptioninclude a combination of settings that can lead to your app... -
I Use /uses
Back in 2023 I quietly published my /uses slashpage. Today I gave it a pass to update things that had fallen out of date.
-
How to Send a Webmention with h-entry
Notify sites that you have linked to them with extra context: is your content a reply, a review, a bookmark, or even a checkin?
-
Ask Git to Show a Method
Easily view the source of a function or method in your terminal using Git and this shell script.
-
Highlighting Text in Links with Text Fragments
I’ve used URL text fragments in a few posts now and often use it outside of this blog to point someone to a particular piece of text on a page. They’re a really useful feature that allows you to create a URL that links not just to a page or an anchor on that page, but specifically to a bit of...
-
Statistics for My Blog
When thinking about how to kick off NaBloPoMo 2024 this past weekend, instead of picking one of several drafts or mostly written articles I naturally decided that we should instead start with something fresh!
-
Using WidgetKit + SwiftData
When working with a PersistentModel to a widget in SwiftUI, you may run into “failed to find a currently active container” crashes.
-
Write cleaner, self-documented tests by defining methods in RSpec
Writing methods in RSpec lets us clean up our tests while improving their documentation value and isolation.
-
sensoryFeedback Samples App
SensoryFeedbackSamples is an Open Source multiplatform SwiftUI app that provides a testing palette for SwiftUI’s new
.sensoryFeedback(_, trigger:)modifier. -
Reading JSON from a Rails API in Swift
Code dive into parsing dates and times with Swift’s Decodable as formatted by Rails APIs
-
Drawing a Hex Grid in SwiftUI
Build a grid or tessellation of Hexagon shapes in SwiftUI, useful for maps in role-playing games or for artfully displaying photos in a pattern.
-
Work with Me
I’m a developer, conference speaker and organizer, technical blogger, and mentor with over 13 years of experience in Ruby on Rails and Postgres. I’ve recently been learning iOS development with Swift and SwiftUI and would love to explore a role doing more professionally. Across my career I’ve...
-
Avoid Services that Don't Make it Easy to Get Your Data
Like everyone, I use a lot of apps and services for various things. I’m writing this article into Notion right now! I’ll probably check Mastodon in a few minutes. I’m sure I’ll use other apps before the end of the day like Streaks, Reeder, The StoryGraph, Overcast, Serializd, United, and Parcel.
-
Reduce Rails' Boot Memory by Removing Mail
Rail’s
actionmailboxand Ruby’smail(used by bothactionmailboxandactionmailer) gems create a lot of memory bloat in applications, and they’re often not required for your app. -
How to Stash Everything git commit Wouldn't Commit
With a couple of flags, git stash can shove everything that git commit wouldn’t store into a stash commit.
-
See the History of a Method with git log -L
Git can “trace the evolution” of a specific method, showing you logs of how it has changed over time.
-
Undo in assets:clobber What You Do in assets:precompile
As a best practice, when you enhance your Rails app’s
assets:precompiletask to build static assets that can be served faster than if they needed to be compiled at runtime, you should also enhanceassets:clobberto remove the artifacts you create. -
I Built a Linklog
In the spirit of Daring Fireball and to fill a space between a social post or boost and a full blog post, I’ve created a new feature for Hearthside that allows me to share a link to a web page that I want to share along with some brief notes and, usually, a quote. It’s similar to social...
-
/now Hear This
/now answers “what are you up to recently?” and you should have one.
-
The Decree Design Pattern
The Decree pattern helps developers write single-purpose service objects that have a predictable API contract, are composable, are easily tested, and isolate the core logic of your app.
-
This Gem is Mentionable
Mentionable is a gem that provides support for inbound Webmentions and microformats in Rails apps.
-
Read Ruby's Enumerable Docs
Become familiar with Enumerable to grow as Rubyist and write clearer, more performant code.
-
Painting and Proficiency With Your Tools
Musings on collaboration, adaptability, and learning focused through my hobby of painting miniatures.
-
Chesterton's Fence
We should heed Chesterton’s Fence and be careful to consider why our teammates wrote the code that they did before we look at it and think “there is a better way”.
-
The Five Minute Standup
I’ve been experimenting with a 5 minute standup meeting rather than allowing standups to run long. Scheduling them at 5 minutes before the hour and allowing them to go a little long if necessary has been really effective at keeping the team on track.
-
RSpec: The Bad Parts
RSpec is good, but it’s even better with less of it. We’ll first look through a heavily obfuscated real-world example, learning why parts of RSpec like let, subject, before, shared_examples, and behaves like can make your tests hard to read, difficult to navigate, and more complex. We’ll discuss...
-
Ignore RuboCop Changes in git blame
Hide refactoring commits in git-blame by using .git-blame-ignore-revs
-
has_few :god_objects
We can achieve better object design and smaller interfaces by defining associations in one direction only.
-
Design Your Codebase with Low Fan-out, High Fan-in Classes
Smaller, simpler classes are easier to reason about than larger, more complex ones. Building low fan-out, high fan-in classes helps in designing simple systems.
-
The Law of Demeter
Talk to your neighbors, but don’t go into their garages—what is the Law of Demeter, how can we follow it in our code, and when should we make exceptions.
-
Avoid Test Delays And Speed Up Your Development Cycle by Mocking Callbacks
It takes a bit more work to mock a method that has a callback block than one without, but it’s worth it.
-
Custom Hexagon Shape in SwiftUI
Creating custom shapes in SwiftUI is pretty easy. At a high level, to satisfy the Shape protocol you just need to define
path(in rect: CGRect) -> Path. Shape itself conforms to View, so you can even get a preview in XCode of your shape while you build it.
-
Signing Git Commits with Your SSH Key
You could always sign Git commits with a GPG key, but now your SSH key is just as powerful!
-
Mixing it up with Mocktail
Mocktail is a new testing library from the lovely folks at Test Double. It seeks to provide a more modern, less intrusive, and friendlier interface for using test doubles.
-
clamp() for Responsive Design
CSS
clamp()provides a method for setting numerical values with a minimum, maximum, and a calculated value between the two. The syntax iscalc([min], [calculated], [max])and it’s useful for times when you want to scale some value based on the size of the screen by using thevwlength unit. -
Flowing Text Around Images
Magazines, books, and other print layouts sometimes use images that overlap with the text, and have that text wrap around the shape of the image. It can make for an interesting effect, bringing a feeling of motion into a static medium. Done right, the text and image become conceptually closer in...
-
A Site Reborn
I’ve moved my Jekyll site into a Rails app, and I’ve done just enough work to have every post render without errors and added just enough style to make things readable. Some of the site still looks pretty bad, and none of it looks good yet. But that’s ok, because my plan is to rebuild and...
-
CSS-only Submenu Navigation with Post Tags
Our posts have categories, which I’ve used as a “collection” or “series” of posts that are on related topics. Recently, I’ve been writing up campaign notes for my D&D session as the characters themselves in a category simply called Campaign Logs. I’m also hoping to continue to write this type...
-
Come Find Me in the Hallway
As a speaker, you shouldn’t be taking questions on stage after your talk.
-
Overlay Text on Responsive Images
When putting text over an image, readability can be a concern. By combining the responsive HTML5
<picture>container with some best practices for image overlays, we can achieve a good result.
-
The Atonement of J. Robert Oppenheimer
I built software to kill people and I gave a talk about it to warn people to think through their choices. Oppenheimer helped design the atomic bomb - was he able to atone?
-
Jekyll on Heroku
Jekyll, the static website generator written in Ruby and popularized by GitHub, is a great candidate for being run on Heroku.
-
Need a Slug?
Rails provides its own slug generator, so you may not need another gem.
-
Don't Get Distracted
I’m going to tell you about how I took a job building software to kill people.
But don’t get distracted by that; I didn’t know at the time.
-
Salary Social Club
How does your salary compare to others? Is that job offer fair? Does a candidate have reasonable pay expectations? Take the Salary Social Survey and we’ll find out together!
-
Sorting Rubyists
We’ll visualize the steps for several sorting algorithms not only using pretty visualizations on a slide, but also with people as the objects being sorted. Don’t know what an algorithm is, what performance really means, or what “Big O” means, or what these best-, worst-, and average-case time...
-
Stabby Stubbing
Define a .call() on service objects to stub with Procs.
-
Advanced Postgres Performance Tips
What do you do when indexes aren’t enough?
-
Literate Vim
Vim commands are terse and arcane, but very expressive. See a complex command broken down by clause.
-
Interface With Your Database in Go Tests
Go’s interface provides a way to abstract away things like your database for testing.
-
What is this PGP Thing, And How Can I Use It?
The need to keep your personal information, sensitive or nonsensitive, secure from prying eyes isn’t new, but recent events have brought it back into the public eye.
In this workshop, we’ll build and upload public keys, explore Git commit signing, and learn to sign others’ PGP keys. If we have...
-
PGP and You
Learn not only how to use PGP, but why each step is important and how to make decisions when interacting with PGP.
-
Use One Field to Store Names or Addresses
Collect names & addresses from users in a single field, not structured forms.
-
Not Invented Here
Rails is a mixture of design patterns, practices, and magic. In this talk, we’ll explore how Rails embraces ideas from other frameworks and projects.
Active Record was born of Martin Fowler. MVC was the brainchild of Trygve Reenskaug. Rails 3 completely absorbed the Merb project, gaining...
-
How to Accidentally Learn Vim
I have a confession to make: I wasn’t always a Vim user.
-
Multi-Table Full Text Search with Postgres
Easily searching across an application’s data is a pervasive need. If you are lucky, you can get away with simple sorting or searching on a single column, but it is more likely that you need full text search across multiple models, all from a single search field.
-
Use RSpec.vim with tmux and Dispatch
Use Dispatch to open new tmux splits to run tests async.
-
Iceberg Classes
An “Iceberg Class” is loosely defined as a class with more private than public methods, but we will be specifically talking about those classes with only one or two public methods (other than an initializer).
-
External Posts in Jekyll
If you contribute to more than one blog, you may want to have all of your posts show up in a single stream, even if they aren’t hosted on that same site.
-
Store Page Titles in I18n
While the title element is one of the only required tags in HTML, it is often overlooked by developers and designers alike until the end of the development process.
-
crontab: temp file must be edited in place
Solution for error crontab: temp file must be edited in place
-
Sandi Metz’ Four Rules for Developers
Four rules for clean and maintainable code from Sandi Metz
-
It’s for the Orphans!
I often come across GitHub Pages branches (
gh-pages) branches that are simply forks from themasterbranch of the repository. -
5 Useful Tips for a Better Commit Message
You’re already writing decent commit messages. Let’s see if we can level you up to awesome. Other developers, especially you-in-two-weeks and you-from-next-year, will thank you for your forethought and verbosity when they run
git blameto see why that conditional is there. -
Love Your Eyes
You look at code all day. Make it look nice with Pitch.
-
How to Write a README
There is a science and an art to writing an effective README for an open source project.
-
Strong Parameters as Documentation
Besides moving attribute whitelisting to the controller rather than the model, Rails 4’s move to Strong Parameters over
attr_accessibleprovides great documentation about the data with which records are being created.
-
Stop Counting Hours
An Open Letter To the Management of (Generally) Small Companies with Internal Software Teams