Don't Trust the Cops: Sometimes Rubocop is Wrong

My team at work recently upgraded our version of Rubocop, the popular linter used to enforce good Ruby code style. With the upgrade we got a whole bunch of new suggestions and warnings about style violations. One of them that tripped us up was the Performance/Count rule. According to the Rubocop docs: This cop is used to identify usages of count on an Enumerable that follow calls to select or reject.

Shared Examples and Contexts in RSpec

When I first learned testing in Rails, I learned RSpec, but then in my last job, I wrote most of my tests in minitest. I enjoyed the challenge of learning a new test framework and found the tests super fast! But recently, I’ve been working on a project in RSpec again and I have a renewed appreciation for it! In this post, I’m going to talk about how to define and use shared examples and shared contexts in RSpec.

Learning Go

This weekend I went to a workshop to learn Go that was organized by Denise Yu. I wasn’t able to stay for the whole thing, but I got so learn some fundamentals of Go. It was really nice to focus a day learning something new. GOPATH The first thing that caught me off guard was how Go looks for Go code. In the workshop, they glazed over this topic by suggesting that everyone start writing code in ~/go.

Favourite Debugging Trick

Last week I wrote about some of my favourite debugging tools in Ruby. I forgot one trick that I find super useful! Today I was writing a script that would iterate through objects in an S3 bucket and group these objects by similar names. The naming structure looked like this: original.jpg tumb_original.jpg profile_original.jpg So all three of those images should get grouped together because they all come from orignal.jpg. But I got my name comparison muddled and something wasn’t working right.

Creating a tmux Colour Theme

I recently decided to use the Dracula in my coding environment. Love it or hate it, I’ve been working with Vim and tmux for the past two years and I inherited my Vim and tmux configurations from someone else. I dove head first into this environment and got used to it pretty quickly, but I never spent much time configuring it. When I switched Vim over to Dracula, I immediately realized that I needed to change my tmux colours too!

Debugging in Rails with Pry, `bundle open` and `puts`

This week I got to dig into some debugging that I really enjoyed. Well, if you had asked me in the middle of it I might not have been having fun, but I found a solution! I used a handful of tools to approach debugging and they all gave me a little bit more information to solve the problem that I didn’t have before. Here is a bit about each tool and what I find useful about it.

Concatenating MySQL Results with Group_concat and Concat_ws

Recently, I needed to build a query that would transform data in our database into a format that we posted to ElasticSearch. I’ll use the example of blog posts here since they’re easy for everyone to grasp. Imagine that each post can have many tags and you want one field on ElasticSearch with the tag ids and another field that has the tag names and description. Here’s what the database might look like:

Writing Super Fast Queries in Rails

At work this week I had to speed up a background job that was clogging up our queue. This job aggregates data on records and posts to our Elastic Search index. It was suffering from all kinds of extra database calls. I had lots of fun working on this query! It’s so satisfying to make things fast. Here’s a bit of what I learned about building SQL queries that can get tough with a typical ActiveRecord object.

How to Rewrite git History when Collaborating with Others

I was recently working on a new node project, and while I was first testing things out, I committed the contents of the dist directory to git. Later on, I was getting the project set up with Docker, and I realized I didn’t want the dist in the repo as it would increase the size of the Docker image. Removing files from git is a bit tricky. You can add it to the .

Toronto Sound Prints

A couple years back I collaborated with Sheraz Khan on a couple of art projects. For a while, we had a portfolio site exhibiting our artworks but that domain recently expired. One of the projects we worked on together was called Toronto Sound Prints. I really liked the end product for this project, so here’s a sample of what we worked on. We worked with Ryerson University’s SMART Lab to create visual interpretations of data they collected that correlated sound data with stress in human subjects.