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

ActiveRecord::RecordNotFound errors provide quite meaningful error messages that can provide some insight on application details. Consider the following:

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

makandra dev

If you use the Better Errors gem, you will sometimes notice that it can be very slow. This is because...

Shoulda Matchers don't provide canditional validations (validations with if: option). Here is how to write tests for the condition...

When using GROUP BY, MySQL now complains if the SELECT includes columns which are not part of the GROUP BY...

Nowadays it is fairly easy to intercept and modify mails globally before they are sent. All you have to do...

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

jakearchibald.com

TLDR: Browser implementations of HTTP/2 push are horrible. You might end up with worse performance than without pushing. However, the...

Dump this method into your Ruby console to quickly print data in columns. This is helpful for e.g. comparing attributes...

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 you load a dump for development, records may reference images that are not available on your machine.

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

makandra dev

This is a visualization of the files that will be generated by some useful rails generators. Invoke a generator from...

makandra dev
activestate.com

Looks like ActiveState is trying to market a new Ruby distribution for Enterprises: ActiveRuby Enterprise Edition is designed for businesses...

makandra dev

Using VCR to record communication with remote APIs is a great way to stub requests in tests. However, you may...

Add the following to /etc/rc.local: (sleep 3 && echo disable > /proc/acpi/ibm/bluetooth)& Bluetooth icon will be active for a few seconds, then...

makandra dev

Below is a list of some VIM settings I find useful. You can add them to your .vimrc. source $VIMRUNTIME/mswin.vim...

medium.com

As web developers, we know how easy it is to end up with web page bloat. But loading a webpage...

If you have a replication error with MySQL and you know the "error" is okay (e.g. you've executed the...