blog.rubybestpractices.com

class Errormaster CoffeeIsOut = Class.new(StandardError) # is prettier than class CoffeeIsOut < StandardError; end end Reference such an error class with Errormaster...

robots.thoughtbot.com

I think this pattern is really useful not just for upgrading suites from Webrat, but really anywhere you have an...

vim.org

First option is to install it with your package manager: apt-get install vim-puppet vim-addons install puppet

makandra dev
sophos.com

If you’re a Mac user and want to increase the security of your data, check out the attached paper...

validatious.org

validate( "email".is("required").andIsAn("email") );

joshsharpe.com

As far as I know, the only plugin out there that handles this (semantic issue) correctly is Makandra’s Aegis...

There is no one-liner in Ruby or ActiveSupport with the behavior described above. There have been discussions about adding a method like Enumerable#find_map:

makandra dev

If you want Sidekiq to be able to talk to Redis on staging and production servers, you need to add...

Rails is split into a large number of (sub-) frameworks. The most important and central of those are activesupport (extends...

Let's say you have a gem which has the following module: # within the imaginary super gem module SuperClient

...time of queries. While they serve similar purposes they do have some differences in behavior and implementation. PostgreSQL Timeout Type: statement_timeout Scope: Applies to all types of SQL statements...

...INSERT, UPDATE, DELETE). Units: Can be specified in various time units (milliseconds, seconds, minutes). Behavior: If any statement exceeds the specified timeout, PostgreSQL raises an error indicating the statement was...

...move the directory to its new location old_store_path = Pathname.new(old_store_dir) begin FileUtils.rmdir(old_store_path.parent) # cleanup empty directories afterwards rescue Errno::ENOTEMPTY => e # ignore exception for non-empty...

postgresql.org

TL;DR PostgreSQL handles Rails 4+ text and string columns the same. Some libraries may still reflect on the column...

...with :vcr, VCR will complain about any attempted HTTP request. This is the default behaviour. If you want to turn this off temporarily, e.g. to communicate with an actual API...

VCR.use_cassette(name, options) { example.call } end end This saves cassettes here: spec/vcr/ / _ / .yml

When storing floating-point numbers such as prices or totals in an SQL database, always use a DECIMAL column. Never...

When using Chrome for Selenium tests, the chromedriver binary will be used to control Chrome. To debug problems that stem...

tpgi.com

These are the top ten accessibility errors as researched by TPGi, a company focusing on accessibility. See the linked article...

Modern CSS offers the field-sizing property to allow elements to automatically adjust size (width and/or height) to fit their...

...index: true option. Use it only inside create_table or for add_reference (= add_belongs_to) statements, and use add_index for other cases. Never use index: true but only...

makandracards.com

So you're hunting down a regression (or just a bug) and want to use git bisect to find out...

makandra dev
github.com

...large number of ActiveRecord objects only to collect its ID. Edge Rider has a better way. Your relations gain a method #collect_ids that will fetch all IDs in a...

...number of ActiveRecord objects only to collect its column value. Edge Rider has a better way. Your relations gain a method #collect_column that will fetch all column values in...

Geordi provides a pretty neat way to generate beautiful commit messages according to your stories in Linear: geordi commit Geordi reads from a .geordi.yml file inside your repo and connects...

...using a multiple assignment for a Regex are named groups. Especially when your Regex becomes more complicates it is easier to understand and to process. Note: In case a string...

...intensive for large files Other ways to solve this problem Other solutions might work better and make more sense depending on what you are trying to achieve. These alternatives could...