tech blog
-
How to Build a Sinatra App - Part 2 Rendering Views
If you don’t have your basic Sinatra app set up yet, see my previous post. Otherwise, let’s get ready to dig in and build this...
-
How to Build a Basic Sinatra App - Part 1 Basic Setup
I’ve been a Rails developer for a while now so I recently built an app in Sinatra for fun. To help me with this project,...
-
Exploring decorators with the Draper gem
Over the weekend, I implemented a decorator in a personal app using the draper gem. App Context I have an app that tracks logging of...
-
Calculating the difference in timestamps with PostgreSQL
I recently needed to do a little analytic research for our UX team. We wanted to know how long it usually took between the time...
-
Case Statements in PostgreSQL
If you’ve ever had a database table that uses enums (just an integer) or some kind of mysterious code to signify meaning, then you’ve probably...
-
CSS display grid put the magic 🪄 back into my layout
Back in 2018 I wrote this post about a refactor on my tarot-card-reading app that allowed me to scale the quantity of readings and quantity...
-
TIL CSS's only-child pseudo class can easily show/hide content without additional conditional logic
I’ve been messing around in Rails 7’s Hotwire features with this tutorial and today I learned something pretty neato about CSS. Instead of building out...
-
TIL multiple values in a ruby case statement 'when' block
Today I learned that you can include multiple options in a Ruby case statement. I have a helper method that I use to determine which...
-
My tech skills (and life skills) are a weird and beautiful patchwork and so are yours
I’ve been thinking and talking about tech-induced imposter syndrome lately. While my own experience with imposter syndrome has changed over time, I keep trying to...
-
Python for Data Science Resources
Courses & Tutorials Twilio’s Quest: https://www.twilio.com/quest highly recommended for beginners: https://www.udemy.com/course/the-modern-python3-bootcamp/ from the point of view of stuff you already know in SQL: https://mode.com/python-tutorial/ for data science: https://www.udemy.com/course/python-for-data-science-and-machine-learning-bootcamp/...
-
Using FactoryBot for hashes
Sometimes in your test suite you have some big ol’ hashes that you need to build frequently. Having big ol’ hashes being passed all around...
-
Mass-assign empty strings in FactoryBot
I recently had to write some RSpec specs for an importer job that pulled in claims data to a table that had 600 columns. That...
-
Accessing the link_to helper in a Rails controller and adding a link to a flash message
In my food planning app, after clicking a link to add all recipe ingredients to a shopping list, I display a flash message that looks...
-
Nested Layouts in Rails
Nested layouts in rails are pretty neato. You can get a lot of styles and consistency across your site without writing a whole lot of...
-
Putting Some Plain Old Vanilla Javascript in Rails 6
I’ve built a few projects in Rails 6 that don’t have a front end framework and aren’t using webpack. In these projects, I’ve wanted to...
-
Code Review Tips for Beginners
The first time I needed to do a code review, I felt nervous and I was sure that I had nothing to offer. Compared to...
-
Store images with Rails ActiveStorage and Dropbox
I recently implemented cloud image hosting using Rails ActiveStorage and Dropbox. These are the resources that helped me to do it: Pragmatic Studio’s Using ActiveStorage...
-
Render Images from a Dropbox Folder
I take this approach when I am spinning up a Rails app quickly and want to get a quick first draft out the door. It’s...
-
Create a Custom Rails Generator
For this example, I’m creating a generator that builds a file for Rails data migrations. It will behave very much like a Rails schema migration...
-
Migrate Data More Safely in Rails by Raising an Exception
A data migration can fail but still end up in an “up” state. This is a problem because you’ll probably try to roll back that...
-
How to Use Rails' alias_attribute
What it’s For… Renaming an attribute. Ever have an attribute on your Rails model that you wish you had named something else? And actually renaming...
-
Ruby seed output wrapper
The Rails-Provided Method Rails has a handy method that outputs a count and the time it took for a block to run. It’s a nice...
-
A good use of Rails Model Callbacks
What it’s For… Processing some input on the same model. Let’s say we have a User model with a full_name field. Since this is user-entered...
-
Refactor from a hardcoded button to a dropdown form in Rails 6
The Problem I have a food planning app where I make a list of recipes that we will prepare for the week. Each week has...
-
The Rails migration 'change' method is more magic than I thought
Here’s a big fat TIL. The Rails change method can add a column back, including it’s original data type, if you tell it to. I...
-
Write a script to run all CI checks locally
I love having my CI service keep me in line by running a bunch of checks when I push a commit to my GitHub repo....
-
Query by Multiple Fields at Once in Rails
The Problem I recently ran into a problem where I wanted to search by a couple of different fields in my postgres database at the...
-
Unzip 7z Files on a Mac with p7zip
This post is brought to you by 30 minutes of frustration. I hope it saves you some time. 7z is a is not a native...
-
Looking Back Down the Mountain: Growth from a set of Garageband files to Rails 6 & JS
I recently wrote a post about why reflecting on growth is important. So that’s what this post is about. Back in roughly 2013, I had...
-
Looking Back Down the Mountain: Why it's Important to Appreciate the Work it Took to Get You Here
Doing a career change into tech is hard work. There is an endless queue of things to learn and a perpetually moving target of knowing...
-
Script to search for files and folders from the command line
Have you ever renamed a resource in a Rails project but missed a filename or folder name somewhere? Yeah, guilty. Wouldn’t it be handy to...
-
Get out of a loop in pry
Ever been caught in a loop while binding.prying through a spec in RSpec? I have to admit I put myself in that situation far too...
-
Understanding the Observer Pattern
The Observer Pattern is a convenient way to update several objects when one object changes state. For example, let’s say we have a website that...
-
Easily add co-authors to your git commits with this script
I recently learned about git’s Co-authored-by feature which allows you to add collaborators to your commits. I do a lot of pairing at work and...
-
Fetch open source contributor branches easily with this Ruby script
I’ve recently gotten a bunch of pull requests to one of my projects on GitHub. I wanted to review the work and run tests on...
-
Autopopulating Rails Form Data with Vanilla Javascript
The context for this work is an exercise tracking app. There is an Exercise model that has information about an exercise (ex: push-ups), including default...
-
Convenience Methods in Rails are so... Convenient
Several months ago in a code review, someone suggested to me that I wrap a model constant in a convenience method. I thought, “hmmm okay....
-
How to Get Hex Codes from Any Part of Your Mac Screen
Need to get some HEX codes for an image you have locally on your computer? As it turns out, if you have OS X 10.10...
-
Move Code Up/Down a Line in VS Code
I’ve been using Atom for a while, but I figured I’d give Visual Studio Code a shot. For the past few weeks, I’ve used it...
-
Favorite Code Courses & Learning Resources
Originally Posted: 01-27-2019 | Updated: 08-02-2023 I moved this content into a proper page for easy reference. See Resources.
-
Grateful Garment StockAid Project Setup
What is StockAid? StockAid is an inventory management system built in Ruby on Rails for The Grateful Garment Project which provides clothing and toiletries for...
-
How to Toggle the Visibility of Whitespaces in Atom
I recently started working in html.slim, which is whitespace sensitive. In order to edit my slim files successfully, I wanted to be able to see...
-
How to Enable the Trimming of Whitespaces by Language in Atom
I have the whitespaces package installed in Atom, which I love because it trims unnecessary trailing whitespaces from the ends of each line. This is...
-
Set up a Shell Script on Mac for Postgres Backups
I was recently setting up a new computer and I needed to back up and restore several PostgreSQL databases in the process. It occurred to...
-
How to Globally Disable ri and rdoc During Gem Installs
Every time I install Rails, I kick myself for forgetting to add the --no-ri and --no-rdoc flags like this: gem install rails -v 5.2.0 --no-ri...
-
How RuboCop Led me to Implement the Null Object Pattern
Last week, in an effort to level-up my knowledge of Ruby style conventions, I connected Code Climate and installed the RuboCop gem in a few...
-
Refactor: Solving a Pesky Naming Problem
Back in February, I wrote a post about a refactor to this app that made use of a factory-style class for some nifty data construction....
-
How to Get Ruby Data into a Javascript File in Rails
The key here is to figure out where and when the Javascript is being called and then pass the Ruby data to it as an...
-
Legacy Refactor: Separation of Concerns in Sorry Girl Rails app
It’s handy to be applying for jobs because it gives me the excuse to go back to some of my Rails portfolio projects and refactor...
-
Personal Challenge: Action Cable Responses from both the DOM and the Console
Google’s Firebase is a database tool that (among many other things) pushes updated data to all instances of a browser. I think that is pretty...
-
How to Store API Keys and ENV Vars in a create-react-app Project
Conveniently, create-react-app has some built-in functionality to make storing and accessing your API keys and ENV variables easier. There’s no need to install any other...
-
My Favorite Refactor: A Look Back at Growth
When I first started learning programming, I made a command line app that does tarot readings. (You can play with that app here.) As a...
-
Implementing a Cities Autocomplete with the Google Places API in React
I recently built a City Data React app which consumes a separate Rails API. The user inputs a US city, and in return gets local...
-
Favorite/Unfavorite Toggle on Single Rails Model
If you’re looking to add a system of favoriting / unfavoriting to a single Rails 5 model, you’re in the right place. This post uses...
-
Filtering Rails Table Records with Javascript
I like Rails. I’ve felt pretty darned comfortable in the Rails ecosystem for a couple of years now. Branching out into javascript features, however, has...
-
Single Page CRUD App in Rails: Part 3 - Editing Records
Well here we are in the final stretch of making our Rails app AJAX CRUDdy! In this series, I explain how to interact with database...
-
Single Page CRUD App in Rails: Part 2 - Deleting Records
This is the second post in my Single Page CRUD App in Rails series. In this series, I explain how to make changes to database...
-
Single Page CRUD App in Rails: Part 1 - New Records
I’ve been wanting to make the UX of my Rails apps more streamlined, and in some cases, that means a little AJAX. So I built...
-
Using a Factory to Randomize Whether a Card is Drawn Right-side Up or Upside Down
UPDATE: Holy smokes! I’ve just refactored the code in this post to be even better :) See it in this new post. Building the Original...
-
Handy Localhost Bookmarks
A while back, I set up a bookmarks folder in my browser with all of the default localhost addresses I use. It’s come in pretty...
-
Keeping your Polymorphic "like"s Code DRY
I was recently setting up a social media app with BlogPosts, PhotoPosts, and Comments – and I needed to have users be able to “like”...
-
How to fix it when the Rails Server is already running, but not where you can find it
Have you ever accidentally closed a terminal tab while the rails server was still running and weren’t able to find it again? I’ve done this...
-
A Case for Using Procs
I’ve read about and practiced working with Ruby procs – all with contrived examples. That’s all well and good, but for me, the best learning...
-
Finding Prime Numbers in Ruby
Code quizzes commonly have a prime number challenge, which got me to thinking, shouldn’t there already be an is_prime method? Well, yes, there should be....
-
Output to Ruby hashes in one step with each_with_object
Today I discovered Ruby’s each_with_object method and I thought it was pretty nifty. Here is how it works. An example with an output array of...
-
Using Git is like Sending Packages in the Mail
So you’ve just gotten your feet wet with web development or programming and in the whirlwind of setting up your machine for class, you have a...
-
How to Access Your Sublime Snippets
Once I discovered the power of SublimeText’s snippet feature, there was no turning back. Any time I find myself typing a thing that could be automated,...
-
How to make ruby shortcuts (snippets) in Sublime Text
Typing Ruby erb tags is a past time pursued intentionally by… no one? Well, certainly not me! The characters <%= %> don’t exactly flow off of...
-
Using Variables in CSS
If you find yourself working in CSS and missing the ability to use SASS variables, oh boy do I have a treat for you. You...