RSpec allows defining methods inside describe/context blocks which will only exist inside them. However, classes (or any constants, for that...

forums.linuxmint.com

On my Ubuntu MATE machine, switching applications with ALT + TAB was impossible, because it took nearly 2 seconds. The culprit...

If another session is accessing your database you are trying to reset or drop you might have seen the following...

docs.ruby-lang.org

Use return to return from a method. return accepts a value that will be the return value of the...

I frequently find myself needing a combination of group_by, count and sort for quick statistics. Here's a method...

There are many approaches out there how you can import data from a legacy application to a new application. Here...

You should prefer native promises to jQuery's Deferreds. Native promises are much faster than their jQuery equivalent. Native promises...

makandra dev

In the ruby shell (IRB) and rails console the return value of the previous command is saved in _ (underscore). This...

You can not use the hash_including argument matcher with a nested hash: describe 'user' do let(:user) { {id: 1...

select2 is a great jQuery library to make (large) fields more usable. For Bootstrap 3 there is select2-bootstrap-theme...

Capistrano has the concept of a "rollback" that comes in really handy in case of errors. When you notice that...

github.com

When storing a file with Carrierwave, it is always cached prior to actually storing it (to support form roundtrips).

This card will show you a cool way to define a class using Struct.new. A common usecase for Structs are...

Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...

When you have a multi-server setup, you'll be adding a new server from time to time. Before doing...

Rails supports time zones, but there are several pitfalls. Most importantly because Time.now and Time.current are completely different things and...

Webmocks hash_including is similar to RSpec::Mocks::ArgumentMatchers#hash_including. Be aware that hash_including (webmock v3.0.1) doesn't...

Typhoeus has a different way of representing array params in a get request than RestClient. Typhoeus: http://example.com/?foo[0]=1&foo[1]=2&foo[2]=3

Sometimes, through some firewall or proxy misconfiguration, you might have to deploy to a server that cannot access the git...

Database connections are not thread-safe. That's why ActiveRecord uses a separate database connection for each thread.

makandra dev

This card compares patterns to store trees in a relation database like MySQL or PostgreSQL. Implementation examples are for the...

github.com

The parallel-gem is quite easy to use and can speed up rendering time if you want to render the...

When filling out forms in Selenium tests, Chrome shows the (usual) bubble, asking to store those credentials. While the bubble...

ImageMagick has a command line tool called identify which can read image metadata: >identify -verbose DSC00136.JPG Image: DSC00136.JPG Format: JPEG...