What we know about PDFKit
PDFKit converts a web page to a PDF document. It uses a Webkit engine under the hood...
Alternative for Ruby singletons
require 'net/http' module Cheat extend self # the magic ingredient def host @host ||= 'http://cheat.errtheblog.com/' end def http @http ||= Net...
What edge_rider offers you
edge_rider is Power tools for ActiveRecord relations (scopes). Please note that some of the functions edge_rider provides have...
MySql lost connection trouble
Directly from the MySql docs: There are three likely causes for this error message. Usually it indicates network connectivity trouble...
terminator keyboard shortcuts
When connecting to multiple (i.e. > 4) servers to dive into logfiles or do security updates, terminator is what you want...
assignable_values 0.11.0 can return *intended* assignable values
As you know, assignable_values does not invalidate a record even when an attribute value becomes unassignable. See this example...
PSA: Umlauts are not always what they seem to be
When you have a string containing umlauts which don't behave as expected (are not matched with a regexp, can...
Discarding cached SQL query results in ActiveRecord
ActiveRecord caches results of SQL queries. If you want to discard the cached results for one model, you can call...
Retrieving the class an ActiveRecord scope is based on
Edge Rider gives your relations a method #origin_class that returns the class the relation is based on.
What's new in edge Rails: Active Record enums
Declare an enum attribute where the values map to integers in the database, but can be queried by name.
Why Ruby Class Methods Resist Refactoring
Splitting a long method into sub methods is easier in instances since it is in classes. Since...
Why your previous developer was terrible
When you, as a developer, look at the choices used to build a particular application, you’re blown away at...
BrowserStack has browser plugins for local testing
Local testing allows you to test your private and internal servers using the BrowserStack cloud, which has support for firewalls...
ActiveRecord: validate_uniqueness_of is case sensitive by default
By default, Rails' validates_uniqueness_of does not consider "username" and "USERNAME" to be a collision. If you use MySQL...
Your Rails sandbox console
Just found out about a great feature in Rails that seems to be around since Rails 2. Start a console...
Don't ever use the float type for database columns
Like in any language, a FLOAT will eventually corrupt data due to rounding errors. Please use DECIMAL, which has well...
Using Arel to Compose SQL Queries
Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass...
[Openstack] "Failed to schedule_prep_resize: No valid host was found." when trying to resize an instance
If you get this error while trying to resize an openstack instance: # nova resize fooinstance 16 --poll ==> /var/log/nova/nova-scheduler.log <==
Bash: Setting the title of your terminal tab
If your terminal has many tabs, you'll want to keep them organized. To change their title from the prompt...
How to load only a subset of a massive MySQL dump
I had a huge MySQL dump that took forever (as in: days) to import, while I actually just wanted to...
Don't use "self" as a Javascript variable
You might sometimes use self to capture the context of this before it is destroyed by some function. Unfortunately self...
The new Modularity 2 syntax
We have released Modularity 2. It has many incompatible changes. See below for a script to migrate your applications automatically...
Careful with '||=' - it's not 'memoize'
When you do something like this in your code: def var_value @var ||= some_expensive_calculation end
Threads and processes in a Capybara/Selenium session
TLDR: This card explains which threads and processes interact with each other when you run a Selenium test with Capybara...