Refinements: Fancy Monkey-patching

A common gripe I’ve heard people bring up about Ruby is the fact that you can monkey-patch basically anything at any point during runtime. The result is that the world your code expects could potentially change under it and all hell breaks loose.  What if you included a 3rd party library that changed your expectations… Read more »

Playing with Crystal Lang

Today I spent a few hours playing around with the Crystal language.  For a project that’s considered “new” the docs are pretty great.  Coming from the world of Ruby writing basic Crystal code is straightforward and most of everything works as expected. For fun and science I decided to try and throw together a simple… Read more »

Docker Image Cleanup

I’ve been playing with Docker off and on for almost a year and noticed that I have a lot of abandoned images on my system that are left over from experimenting.  This post contains a few commands you can use to clean up your system. To illustrate what I mean by “abandoned images”, here’s the output… Read more »

How Big is My Database?

Here’s a nice snippet that can be used in a PostgreSQL database to output the current database’s size. SELECT pg_size_pretty(pg_database_size(current_database())) AS human_size,        pg_database_size(current_database())                 AS raw_size; That statement will output something along the lines of: human_size | raw_size ————+————– 181 GB | 193841573064

Moving from GitLab to GitHub

At work we have been using GitLab for a while and it’s been pretty good but we have recently opted to move to GitHub Enterprise.  As a result there are a number of small repos we have hosted on GitLab that now need to be moved over to GitHub. Additionally, this should generically work for any… Read more »

Installing Nokogiri on El Capitan

EDIT: This post has been updated and retitled for El Capitan.   If you have attempted to install the Nokogiri gem and encountered errors similar to the output below… I feel your pain and have a solution. The Pain ➜ z gem install nokogiri Building native extensions. This could take a while… ERROR: Error installing nokogiri:… Read more »

A Toy Story Based Mnemonic Device for has_one

Here’s an awesome Toy Story inspired mnemonic device for remembering the proper use of Rails’ `has_one` associations. Andy “has_one” Woody. Woody “belongs_to” Andy. Where is the foreign key? On Woody’s sole! Credit goes to Stack Overflow user “mike” from a comment on a related topic.

JIRA.

Rake Tasks, Arguments and Default Values

I had a discussion with a coworker today where he openly asked if rake tasks can take arguments… and if they can, can the task’s arguments have default values set. Passing defaulted arguments to a rake task is actually super easy and I can definitely empathize with people who ask have no idea this is possible…. Read more »

Getting the pg Gem Installed with Postgres.app

I use Postgres.app to run a local Postgres server while doing development work and it’s great. Postgres.app basically provides a completely contained pg server that’s ready to go out of the box — just launch the app and you’re good to go. Unfortunately because it’s a self contained app things are installed in non-standard places…. Read more »