developer.chrome.com

The File System Access API is a new capability of modern browsers that allows us to iterate over selected folders...

There's a method Integer() defined on Kernel, that typecasts everything into an Integer. Integer("2") # 2 Integer("foo") # Invalid...

Rails 7.1 added the normalizes method which can be used to normalize user input. It lets you define the fields...

tl;dr The :is() pseudo selector - specificity of its most specific argument - matches against a comma-separated list of selectors...

tl;dr The :where() pseudo selector - zero specificity - matches against a comma-separated list of selectors. Example Compound selectors like...

...Capybara see the print stylesheet Capybara always requests as the screen medium. The step belows reloads the current page with a query param we will use in our layout to...

Development environment setup Rails Composer Basically a comprehensive Rails Template. Prepares your development environment and lets you select web server...

use Postgres' lower() function add an index on lower(email) Probably the best approach is to just convert emails (and usernames) to lowercase within Rails. Popular authentication libraries...

Tested on Ubunut 22.04 1. Opener script Create a file ~/.local/bin/coverage_zip_opener with: #!/bin/bash tmp_folder="/tmp/coverage-report-opener" if [ -z "$1" ]

...to be performed around a deploy. Be it to notify operations about changed application behavior, be it to run a little oneline script after the deploy. Most database-related stuff...

makandra dev

While debugging a SPF record I found spf-record.de to be very helpful. it lists all IPs that are covered by...

makandra dev

We structure our CSS using the BEM pattern. Our naming convention for blocks, elements and modifiers has evolved over the years. This card shows our current style and various alternative...

...not mix styles and be consistent within a given project. Current convention Our current BEM naming convention looks like this:

Note how the modifier just starts with a dash (-pro...

} Enumerable#index_with (Rails 6+) To generate a hash where array elements become hash keys, and values are calculated from them, use index_with. users = User.all

github.com

Let the following setup: # my_model_spec.rb describe MyModel do it 'perfoms a test' it_behaves_like 'something shared' end # something_shared.rb shared_examples_for 'something shared' do it 'does something'

...a test' is spec/models/my_model_spec.rb[1:1]. The ID of the ExampleGroup created by it_behaves_like 'something shared' is spec/models/my_model_spec.rb[1:2] as it is the second ExampleGroup in the...

=> #<Capybara::Node::Element tag="div" path=... If you rely on this behavior in Capybara 3, affected features will fail. The gem no longer normalizes whitespace when finding...

...visible css ".haystack" with text "Hi! Try to match me." Re-enabling Cabyara 2 behavior in Capybara 3 After digging in the documentation, you might figure out that you can...

I had to modify the time for an application that I launch through Docker. Here is an approach that worked...

api.rubyonrails.org

Rails offers a way to prepend (or append) view paths for the current request. This way, you can make the...

For string columns, MySQL indexes the left side of a string. That means an index can speed a like query...

...record, :match_requests_on).except(:example_group) VCR.use_cassette(name, options) { example.call } end end Behaviour If a spec is not tagged 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 while writing a new spec, simply add the line...

Some users might use Adblock Plus or similar browser plugins to reduce the number of ads displayed. If you run...

makandra Curriculum

Understand what Memoization is and when it can be useful. Understand the @variable ||= computation pattern. Learn how to use...

morris-photographics.com

Some browsers render PNG images with color profiles and other shenanigans, some don't. The cleanest way to have consistent...

makandra dev
rails-sqli.org

This page lists many query methods and options in ActiveRecord which do not sanitize raw SQL arguments and are not...

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