...Before merging back: reinstate reverted features in a temporary branch, then merge that branch. Scenario Consider your team has been working on several features in a branch, made many changes...
...fix them, if necessary. Maybe tests were added that expect the removed functionality as a side-effect. Merge the master into your branch regularly, especially when you have multiple teams...
tl;dr When browsers start to adapt proposals from Open UI, it might not be necessary to use any 3rd party libraries to have nice components and controls in web...
...applications e.g. selects. It would require only a minimum of CSS and Javascript to get them working and looking good. The purpose of the Open UI, a W3C Community Group...
...listen to other events. Quirks The "default behavior" in this case is not to show an alert, and preventing this default means the alert is being shown. In ancient browsers...
...customize the alert text, but this is no longer possible. You might want to set event.returnValue = true, as a truthy returnValue was necessary to trigger the alert in Chrome...
Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag these posts with a limited number of tags. The following...
...In most cases you want to use Option 4 with assignable values. The basic setup for all options looks like this: config/routes.rb Rails.application.routes.draw do root "posts#index" resources :posts, except...
Sometimes the need arises for SSL in local development. We have guides for different webservers, this one is for puma. make sure mkcert is installed create an SSL certificate for...
...bundle exec rails s Accept the certificate in your browser See also Creating a self-signed certificate for local HTTPS development
In Rails, we usually have a mailer setup like this: class MyMailer < ActionMailer::Base def newsletter mail to: 'receiver@host.tld', from: 'sender@host.tld', subject: 'My mail' end end If you want to...
...Rails will print the mail's text representation to your log/development.log. You may also save this output as-is to an .eml file and open it with your mail client...
Some users might use Adblock Plus or similar browser plugins to reduce the number of ads displayed. If you run into an issue that your application or part of an...
...our web apps. But if your application uses iframes or is embedded in another site it's more prone to it. Blocked elements most of the time appear to the...
The issue: You are using stub_const to change a constant value for your test. stub_const "SomeClass::CONST", 'test' All of a sudden, tests fail with undefined method 'some...
...method' for # . The reason When using stub_const before the Class containing the constant has been loaded, a module is automatically created with the name. Since RSpec does no autoloading...
...git rebase -i main. What it does: Opens an interactive rebase UI to choose squash/edit/fixup for each commit of your branch until the first commit (the base). Keeps your branch...
...s base intact (no rebasing onto main). Lets you squash, reorder, edit, or drop commits. Info This is not the same as git rebase -i main, which would rebase your...
...If you are plucking from the id column in particular you can also say: User.active.ids => [1, 5, 23, 42] For a DISTINCT selection, use distinct on your scope (not the...
...resulting array). Article.distinct.pluck(:state) # SELECT DISTINCT state FROM articles => ['draft', 'published'] In Rails 3 and 4 you must use uniq instead of distinct: Article.uniq.pluck(:state) # SELECT DISTINCT state FROM articles...
...optimize the experience. Using capistrano-rails capistrano-rails is a Gem that adds Rails specifics to Capistrano, i.e. support for Bundler, assets, and migrations. While it is designed for Asset...
...Pipeline (Sprockets) assets, it can easily be configured for Webpacker. This brings these features to the Webpacker world: Automatic removal of expired assets Manifest backups # config/deploy.rb # No need to include...
Let's say you have a form that you render a few times but you would like to customize your submit section each time. You can achieve this by rendering...
...form partial as layout and passing in a block. Your template or partial then serves as the surrounding layout of the block that you pass in. You can then yield...
If you want to build a small CLI application, that supports more advanced inputs than gets, I recommend using the cli-ui gem. It's a small dependency-free library...
...that provides basic building blocks, like an interactive prompt: require "cli/ui" CLI::UI::StdoutRouter.enable puts CLI::UI.fmt "a small {{red:demo}}" # supports h, j, k, l, arrows and even filtering...
...Layouts tab you have handy options to debug CSS Flexbox and Grid. Including: Display size and lines along with labels Changing their attributes Change how overlay is colored and fastly...
...switch nested elements in the Elements panel This guide will only cover some example gif recordings on how to use with Grid, since it's basically straight forward to apply...
...don't only have a favicon.ico in your project but also PNGs of different sizes and backgrounds, you should test if all those files are actually reachable.
...few selectors to get you started: 'link[rel~="icon"]' # regular ones, matches "shortcut icon" and "icon" 'link[rel="apple-touch-icon"]' # iOS 'meta[content][name="msapplication-TileImage"]' # IE11 'meta[content...
...some beyond 50MB. Unless you need to offer this large files, you should always shrink uploaded files to a reasonable resolution. class ImageUploader < CarrierWave::Uploader::Base process resize_to_limit...
...modern JavaScript down to EcmaScript 5. Depending on what browser a project needs to support, the final Webpack output needs to be different. E.g. when we need to support IE11...
...JavaScript features. Hence our output will be more verbose than when we only need support modern browsers. Rails 5.1+ projects often use Webpacker to preconfigure the Webpack pipeline for us...
In Cucumber, scenario outlines help avoiding tests that are basically the same, except for a few variables (such as different inputs). So far, nothing new. The problem
...your test should (or should not) do something, like filling in a field only for some tests? Scenario Outline: ... When I open the form And I fill in "Name" with...
When you make a simple TCP connection to a remote server (like telnet), your client won't normally notice when the connection is unexpectly severed on the remote side. E.g...
...if someone would disconnect a network cable from the server you're connected to, no client would notice. It would simply look like nothing is being sent. You can detect...
...GitHub repository is a bit like our "dev" cards deck, but groomed from a single person (Josh Branchaud). It includes an extensive list of over 900 TILs on many topics...
...TILs that were new to me. I encourage you to take your time to skim over the original list as well! Assoc For Hashes Hash#assoc can be used to...
Bundler allows you to specify the name of the Gemfile you want to bundle with the BUNDLE_GEMFILE environment variable. BUNDLE_GEMFILE=Gemfile.rails.7.2 bundle By default, bundler will look...
...have multiple Gemfiles in your project, which cannot all be named Gemfile. Let's say for example, you maintain a gem and want to run automated tests against multiple rails...
When testing your command line application with Aruba, you might need to stub out other binaries you don't want to be invoked by your test. Aruba Doubles is a...
Install the gem as instructed by its README, then put this Before block somewhere into features/support: Before do ArubaDoubles::Double.setup prepend_environment_variable 'PATH', ArubaDoubles::Double.bindir + ':' end
...to do it. Make an educated decision: Is the code change worth the effort? Stay straight on track, don't go astray. Note: Usually, you'd refactor after finishing your...
...story. At times, it might be necessary to refactor up front. But try to keep refactoring out of your current task. Knowing where to optimize Things should only be optimized...
I recently did a quick research on how to better write down multiline statements like this: # Dockerfile RUN export DEBIAN_FRONTEND=noninteractive \ && apt-get update \ && apt-get dist-upgrade -y...
...apt-get install --no-install-recommends --no-install-suggests -y \ ca-certificates \ curl \ unzip It turns out, there is! Buildkit, the tool behind docker build added support for heredoc strings...