makandra dev

...changes you make to the database will be rolled back on exit. Warning Changes beyond the database (deleting files, sending emails, etc) cannot be rolled back...

...shared_examples_for can have parameters. You can simply hand over arguments from it_behaves_like: shared_examples_for 'string equaling another string' do |expected_string| it 'is equal to...

...subject).to eq(expected_string) end end describe 'some string' do subject { 'foo' } it_behaves_like 'string equaling another string', 'foo' end RSpec 1 Use it_should_act_like from...

Capybara provides execute_script and evaluate_script to execute JavaScript code in a Selenium-controlled browser. This however is not...

haml.info

...nesting level of elements. When it comes to white-space preserving content, this may become a problem: the content will be rendered including the HTML indentation. Problematic: Preserved Indentation

%pre = content Reference Hello World Better: Without Extra Indentation Render with tilde ~ instead of equals = to keep Haml from indenting content: .nest %span Reference %pre ~ content Reference

When users type into a Tom Select control, the options list is updated with a short delay which can feel...

Rails' url_for is useful for generating routes from a Hash, but can lead to an open redirect vulnerability.

developer.mozilla.org

The linked MDN article is quite informative of a neat feature supported by all major browsers: Unicode character class escape...

If the project team consists of at least 2 members, do a daily standup. It should not take much longer...

Cookies without an expiration timestamp are called "session cookies". [1] They should only be kept until the end of the...

This card explains how to generate an entity relationship diagram for your Rails application. We also show how to limit...

In a web application you sometimes have tasks that can not be processed during a request but need to go...

Since I use this a lot in my daily work and there were no scripts working properly for me, I...

I recently enjoyed debugging a Cucumber step that tried to be retryable using a patiently block: Then /^"([^"]*)" should( not)? be...

For Rails models where only one of multiple attributes may be filled out at the same time, there is no...

I encountered a unlucky behavior of byebug 11.1.3 (the most recent version at time of writing) when using it with Rails 6 and it's new autoloading component, zeitwerk. There...

Building application assets with esbuild is the new way to do it, and it's great, especially in combination with...

relishapp.com

In RSpec you can tag examples or example groups with any tags you like simply by saying describe ReportCreator, slow...

You can use local copies of gems in your Gemfile like this: gem 'spreewald', path: '~/gems/spreewald' As soon as you...

Bundler allows you to specify the name of the Gemfile you want to bundle with the BUNDLE_GEMFILE environment variable...

makandra dev

A lesser known fact about PG enums is that they are ordered. This can be really handy when values have...

island94.org

Rails 5.2 soft-deprecated the storage of secrets in secrets.yml in favor of a new thing, credentials.yml.enc. Rails 7.1 deprecated...

IRB 1.2 (shipped with Ruby 2.7, but works on 2.5+) brings pretty syntax highlighting and multiline cursor navigation. However, pasting...

The Node Version Manager allows installing multiple NodeJS versions and switching between them. By default, it does not automatically switch...

...between added? and of_kind? While added? might feel more natural to use, it behaves differently than of_kind? because it also compares options from the validation error. of_kind...