Using Turbo Frame tags within a ViewComponent

posted in articles

 

ViewComponents and Hotwire are incredible for orchestrating a beautiful, reusable View layer. While working with the two, I came across a case where I wanted a component to update via a Turbo Frame but was unable to utilize the turbo-rails gem’s built-in turbo_frame_tag. Let’s get into this simple fix.

Grouping SQL results by month

posted in articles

 

When working with big datasets, it is useful to be able to investigate correlations between records. Knowing most popular components of an application or highest usage of a feature can help a team prioritize their efforts. One technique I’ve used is to group results by month to visualize the trend line of a query.

When is an Array an Array? Strategies for checking Array equality in Ruby

posted in articles

 

Object equality is an interesting topic. You can check for matching values (with or without ordering). You can also check to see if the object has the same in-memory id. I’ve written code to diff two arrays before but I’ve never sat down to think about all the ways to accomplish this. Also I was able to explore what I believe are the most optimal approaches.

How to fix homebrew postgres error 256

posted in today i learned

 

At home, I’m a Linux user but at work most companies use Mac for engineers. It’s been a couple years since I’ve used Mac so I’m learning my way back around it along with Homebrew. One issue I ran into the other day was postgresql service not starting sucessfully. No amount of brew services restart postgresql would fix it. Turns out to be a pretty simple fix.

Don't Slack on Site Reliability

posted in tutorials

 

Alright, bit of a clickbait title but if you know me you’ll know my love for bad puns. Ensuring a healthy running application is an important part of your infrastructure reliability. Site Reliabiltiy is an entire discipline by itself as there are a wealth of topics and concepts associated with it. That being said having really solid Site Reliability as a start-up isn’t always the first priority. This article details some of the steps I’ve taken to have basic application monitoring in place easily and cheaply.

Lemme pencil you in: Using iCalendar and Rails to sync calendar events

posted in tutorials

 

If you’ve worked with calendars, then you know the frustration of having two systems not keep events in sync. There are essentially three levels to keeping events in sync. The first is integration with every email provider you wish to support. Not a light initiative. The second is to find a product which aggregates multiple providers into a single API interface. Better solution, but open your wallet. Lastly, build a lightweight system that relies on the iCalendar standard. This last option is the focus of the article. Throughout the remainder of this post, we’ll explore pushing an event to an external provider’s calendar and keeping it in sync across systems without writing a single API request or integration.

Introducing SimpleCov+ Action: A Github action for ensuring test coverage

posted in articles

 

Testing your code thoroughly is an important part of a well functioning and easy to change application. Lack of adequate test coverage can be frustrating when refactoring, upgrading, or tracking down a bug. I’ve always wanted a way to ensure that each file maintains a minimum test coverage and if not fail continuous integration checks. After much searching, I decided to go ahead and build my own. Introducing SimpleCov+ Action for use within your Github actions.

Simulating a select dropdown change in Jest

posted in today i learned

 

While building a mobile friendly tab component, I created a select dropdown that allowed the user to control the displayed content. This worked in tandem with the existing click the name of the tab setup. Testing a simple click event is trivial by using .click() but I quickly found that simulating a select dropdown change wasn’t as straightforward nor as documented. I stumbled on the following solution which hopefully helps someone else stuck.