The github pages DNS takeover incident
This website, andreaschiavini.com, is hosted on GitHub Pages. The domain is registered on Namecheap, and the integration was done following instructions on this gist. Last week, I received an emai...
This website, andreaschiavini.com, is hosted on GitHub Pages. The domain is registered on Namecheap, and the integration was done following instructions on this gist. Last week, I received an emai...
Wow, it’s been quite a long time since my last post. I’m still a vim addict, but I moved to neovim in the recent years, and today I wanna share a quick trick that you might find useful. I’m going ...
I like to change my (neo)vim colorscheme quite frequently, and when I do I want it to match my iterm colors. Many colorscheme authors also provide an iterm color palette, so you can import the .ite...
Yesterday I had to refactor a very large ruby class. It had a lot of methods and, to make it cleaner, I decided to sort methods alphabetically. Is there a way to do this in vim? Of course there is...
Minitest is good for mocking, right? Well… Minitest is gaining a lot of popularity and can actually be a 100% replacement for RSpec. It’s a pure ruby testing framework, it’s fast, light weight, an...
The problem If you have a growing Rails application and you feel your models are getting too fat you might have a problem. We’ve all been educated with the “fat models, thin controllers” dogma - b...
Hi everyone! What we’re trying to tackle today is a very common problem, that I’m sure all of you encountered. Suppose you’re on your git feature branch, you want to merge it into another branch (...
The problem Recently I’ve seen in a project I work on a lot of occurrences of this code: if user.privacy && user.privacy.enables_page?(...) The first part of the condition above is a ba...
Fluentd is an open source tool to collect events and logs. Its architecture allows to easily collect logs from different input sources and redirect them to different output sinks. Some input exampl...
Today after releasing an app to production environment I saw a couple of paperclip warnings like this in my production.log file: [paperclip] Duplicate URL for round_image with /system/:attachment/...
Today I wrote a regexp to change params[:page] into page. Here you are: :'<,'>s/params\[:\(\p\{-}\)\]/\1/g Let’s explain it briefly: the first part, :'<,'>s/, is the vim com...
Ctags are a great way to improve navigation between large codebases. Used together with vim they allow to quickly jump to any method definition with just a keystroke - C-]. Adding your bundle dir w...
In a project I’m working on I’m using spree as a mountable engine. The host application has its own administration area, and I wanted to share the spree authentication with my app. Spree uses devi...
I have a lot of Vim colorschemes, and I like to change them very often, reflecting my mood. I needed a way to showcase them all and quickly pick one. The original Vim Color Scheme Test script by m...
In a Rails application I am working on, I needed to setup a form with a field with a non-standard behaviour. The field represents a Date object, so the date_select FormHelper looked great; however,...
Today I decided to verify if Machinist could be a good replacement for Factory Girl. In our project, we have a big problem with Factory Girl: even if you tell her not to hit the database, using the...
If you have a Rails rake task that somehow changes your DB data, but you want to be sure that the DB will be rolled back to its previous state after the rake task has completed, you can simply incl...
There are already many posts about this, but maybe this simple example will help you understand this subject even better. # First model: tag.rb # note that pomodori is a custom plural for pomodoro...
I’d bet a lot of ruby devs actually found themselves stuck in this problem. You checkout a github repo, you run a bundle install and - duh - a gem cannot install because of a missing library. You’r...
It may happen that you need to display the results of a MySQL query on a page. E.g., your customer asks you to add a report on a page, and you don’t want to build a custom template, but just write ...