While both the alt attribute and the figcaption element provide a way to describe images, the way we write for...
So you're hunting down a regression (or just a bug) and want to use git bisect to find out...
...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...
...using a multiple assignment for a Regex are named groups. Especially when your Regex becomes more complicates it is easier to understand and to process. Note: In case a string...
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...
A lesser known fact about PG enums is that they are ordered. This can be really handy when values have...
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...
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...
...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...
The Node Version Manager allows installing multiple NodeJS versions and switching between them. By default, it does not automatically switch...
...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...
Bundler allows you to specify the name of the Gemfile you want to bundle with the BUNDLE_GEMFILE environment variable...
...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...
The robots.txt file and HTML tag can be used to control the behavior of search engine crawlers. Both have different effects. robots.txt Marking a URL path as "disallowed" in robots.txt...
If you ever need to restore exact records from one database to another, Marshal might come in handy. Marshal.dump is...
...Middleman brings Haml, Sass, helpers etc. However, it can be configured to do even better. This card is a list of improvement hints for a Rails developer. Gemfile
...helpers in a helpers {...
...} block. However, this does not scale very well. You're best off creating a /helpers directory and putting helper files there just like you know it...
Besides Plotting graphs in Ruby with Gruff, which comes handy for many uses cases, you sometimes might need configuration for more advanced plots, e.g. for academic concerns. Then using Gnuplot...
...where each array holds the data for x-, y- or z-axis. The major benefit of numo-gnuplot is that it supports advanced numpy like array operations, like multi array...
In RSpec you can tag examples or example groups with any tags you like simply by saying describe ReportCreator, slow...
SimpleForm is a great approach to simplifying your forms, and it comes with lots of well-defined input types. However...
Let's say you have a gem which has the following module: module SuperClient def self.foo 'Foo' end
When changing code in mailers, updating the corresponding mailer preview can be forgotten very easily. Mailer previews can be tested...
...Rails has a method ActiveRecord::Relation#merge that can merge ActiveRecord scopes. However, its behavior has never been clear, and in Rails 7 it still discards conditions on the same...
...column by the last condition. We discourage using #merge!) The best way to merge ActiveRecord scopes is using a subquery: scope_a.where(id: scope_b) It is a little less concise...
RSpec 3 has verifying doubles. This breed of mock objects check that any methods being stubbed are present on an...