ActiveStorage PDF Analyzer

I found this code while looking through some EDA project folders on my laptop. It adds a PDF analyzer to ActiveStorage by checking the mime type of the uploaded file for application/pdf and then attaches the metadata from the pdf-reader gem. 1. Add the pdf-reader gem to your Gemfile gem "pdf-reader", "~> 2.14" 2. Add...

Continue reading »

Purge SVG icons in Rails deployment

Over the last few months I’ve enjoyed using Heroicons and Phosphor icon sets. These icons have variants at multiple sizes, are squares, and I don’t require loading a font library. I guess things might change as FontAwesome 7 rolls out, but that hasn’t happened yet. The Setup My setup has been in contant flux but...

Continue reading »

Create a Windows 10 USB from MacOS

These are the steps I use to create a Window 10 installer on MacOS. I only do this once in a blue moon and I want to make sure I keep track of these commands before they are lost in my history. # Format the USB drive as MS-DOS and name it "WIN10" $ diskutil...

Continue reading »

Wrangle Your SQL With Arel by Eric Hayes

This is a fascinating talk that walks through the underlying APIs used to build SQL queries in ActiveRecord. Eric does a great job showing how ORMs use Abstract Syntax Trees to create SQL queries from hashes and method calls. The end result shows how they built an incredibly complex cohort query with efficiency and maintainablity...

Continue reading »

Process HEIC Images with Node on AWS Lambda

I needed to add support for HEIF/HEIC images in my application and thought it would be a fun introduction to AWS Lambda. Since I have minimal experience with AWS and this was an exercise for myself I thought it would also be fun to use Sharp. The first thing I learned is that HEIF is...

Continue reading »