makandra dev

Geordi provides a pretty neat way to generate beautiful commit messages according to your stories in Linear: geordi commit Geordi reads from a .geordi.yml file inside your repo and connects...

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

You can use nmap to find out what service is running behind a given port, and most often see some details about it. This can be helpful if...

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

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

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

The default configuration of Rails disables CSRF protection in tests. If you accidentally forget to send the CSRF token for...

...minimal changes. But that's not always the case, and there is a much better way. Use pnpm up (aliased to update and upgrade) with a set of exact library...

...the HTML required attribute. We usually turn it off due to difficulties controlling its behavior and appearance. Instead we only mark required fields with an asterisk (*) next to its label...

...after submitting the form due to the now displayed error messages. A compromise with better accessibility is to add the aria-required attribute in this case. This allows screen readers...

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

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

When two classes implement the same behavior (methods, callbacks, etc.), you should extract that behavior into a trait or module. This card describes how to test that extracted behavior without...

...repeating yourself. Note that the examples below use Modularity traits to extract shared behavior. This is simply because we like to do it that way at makandra. The same techniques...

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

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

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

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

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

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

makandra dev

...to cancel event propagation, each with different semantics. event.preventDefault() Only prevents the default browser behavior for the click, i.e. going to a different url or submitting a form.

In the Gitlab settings the flag Auto-cancel redundant pipelines is enabled by default. This auto-cancels pipelines with jobs...

When you replace parts of the DOM with new HTML, using .innerHTML = newHtml is usually the simplest and fastest option...

relishapp.com

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

gedd.ski

Within a Flexbox layout, there are multiple CSS attributes that may affect a child's basis (the initial width before...

...like keeping some HTML. If you only care about line breaks, you might be better off using a small, specialized helper method: def format_linebreaks(text) safe_text = h(text...