...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...

makandra dev

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

When you query the browser for DOM elements, there are some footguns you should know about. Some lists are synchronized...

When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc.

stackoverflow.com

This card will show you how to use git rebase --onto without confusion. Use case: You've got two feature...

Fill in find field with e.g. url (? .*?) Hint: the "url" at the beginning of the string is just a text fragment; the (? .*?) is our named capture group.

blog.saeloun.com

Rails' fragment caching caches subtrees of an HTML document tree. While constructing that tree though, it can be really hard...

vertical-align is hard. Have you ever wanted to vertically center an icon with text? This usually means "vertically align...

Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...

...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...

To apply transparency to an element, you can use opacity in CSS. However, sometimes you don't want to make...

...to e.g. lock an entire form while it is being changed. This requires code beyond database locking, in both backend and frontend...

When you find similar groups of expect calls in your tests, you can improve readability by extracting the group into...

This is painful. Consider using Microsoft Office or switching careers. If you need to write < 20 letters consider doing it...

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

makandra dev
tpgi.com

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

TL;DR There are three dimensions you can control when scoping routes: path helpers, URL segments, and controller/view module.

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...

...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...

Performing COUNT(*) on large tables is slow. Sometimes you don’t need the exact number once results exceed a certain...

...all Unpoly updates work using AJAX requests, you won't get the more detailled better_errors page with the interactive REPL. Below is an event listener that automatically repeats the...

...full CSS and JavaScript. The code assumes you are using Ruby on Rails with better_errors, which is the default error view that modern Rails versions employ. If you are...

...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...

When you don't only have a favicon.ico in your project but also PNGs of different sizes and backgrounds, you...

...you obviously do not want to duplicate it and your tests might very well benefit from this approach. Use it with care, however -- doing this more than a few times...

...making the test impossible to read). An alternative is also to hide that functionality behind other steps that do more complex things differently...