All browsers implement an event named beforeunload. It is fired when the active window is closed and can be used to display an alert to warn the user about unsaved...
...To trigger the alert, you have to call preventDefault() on the event. Note The beforeunload event is only dispatched when the user navigation makes a full page load, or if...
...installation supports YJIT, by running: $ ruby --yjit -v ruby 3.3.4 (2024-07-09 revision be1089c8ec) +YJIT [x86_64-linux] If YJIT is not available, the output of this command will...
...move the directory to its new location old_store_path = Pathname.new(old_store_dir) begin FileUtils.rmdir(old_store_path.parent) # cleanup empty directories afterwards rescue Errno::ENOTEMPTY => e # ignore exception for non-empty...
If you want Sidekiq to be able to talk to Redis on staging and production servers, you need to add...
When you query the browser for DOM elements, there are some footguns you should know about. Some lists are synchronized...
When ending a Selenium test Capybara resets the browser state by closing the tab, clearing cookies, localStorage, etc.
This card will show you how to use git rebase --onto without confusion. Use case: You've got two feature...
Fill in find field with e.g. url (? .*?) Hint: the "url" at the beginning of the string is just a text fragment; the (? .*?) is our named capture group.
Rails' fragment caching caches subtrees of an HTML document tree. While constructing that tree though, it can be really hard...
Important wkhtmltopdf is deprecated and shouldn't be used anymore. Please consider switching to another tool We can install wkhtmltopdf...
vertical-align is hard. Have you ever wanted to vertically center an icon with text? This usually means "vertically align...
Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...
...time of queries. While they serve similar purposes they do have some differences in behavior and implementation. PostgreSQL Timeout Type: statement_timeout Scope: Applies to all types of SQL statements...
...INSERT, UPDATE, DELETE). Units: Can be specified in various time units (milliseconds, seconds, minutes). Behavior: If any statement exceeds the specified timeout, PostgreSQL raises an error indicating the statement was...
To apply transparency to an element, you can use opacity in CSS. However, sometimes you don't want to make...
...to e.g. lock an entire form while it is being changed. This requires code beyond database locking, in both backend and frontend...
When you find similar groups of expect calls in your tests, you can improve readability by extracting the group into...
This is painful. Consider using Microsoft Office or switching careers. If you need to write < 20 letters consider doing it...
When using Chrome for Selenium tests, the chromedriver binary will be used to control Chrome. To debug problems that stem...
These are the top ten accessibility errors as researched by TPGi, a company focusing on accessibility. See the linked article...
Hint This applies only to distributions based on Debian. Requirement You need to setup the PostgreSQL Apt Repository first.
...the puppetdb_query feature. This can result in more complex code but has several benefits: you can use more complex puppetdb queries to get the resources you want than with...
TL;DR There are three dimensions you can control when scoping routes: path helpers, URL segments, and controller/view module.
We've already learned how to integrate user-provided images uploads to our application in 205 basic file uploads and...
...large number of ActiveRecord objects only to collect its ID. Edge Rider has a better way. Your relations gain a method #collect_ids that will fetch all IDs in a...
...number of ActiveRecord objects only to collect its column value. Edge Rider has a better way. Your relations gain a method #collect_column that will fetch all column values in...