A JavaScript error in an E2E test with Selenium will not cause your test to fail. This may cause you to miss errors in your frontend code. Using the BrowserConsole...

!!driver_logs_proc end def driver_logs_proc browser = page.driver.browser if browser.respond_to?(:logs) # selenium-webdriver >= 4 proc { browser.logs } elsif browser.respond_to?(:manage) && browser.manage.respond_to?(:logs) # selenium-webdriver...

The simple_format helper method in Rails converts linebreaks of a given string into HTML paragraphs (...

...) or linebreaks ( ). It does not return a plain String, but produces html_safe output...

...i.e. a SafeBuffer). The input String is cleaned up via sanitize. This is not an XSS vulnerability: scripts, event handlers and javascript: URLs are removed. [1] But simple_format does...

CarrierWave comes with a set of default configuration options which make sense in most cases. However, you should review these defaults and adjust for your project wherever necessary.

...also find suggestions on what to change below. Understanding the default configuration Here is the current default config for version 2: config.permissions = 0644 config.directory_permissions = 0755 config.storage_engines = { :file => "CarrierWave...

...exception, Rails will look at the exception's class and choose an appropriate HTTP status code and error page for the response. For instance, an ActiveRecord::RecordNotFound will cause Rails...

...render a red "The page you were looking for doesn't exist" with a status code of "404" (not found). The mapping from exception classes to error types is a...

Why secure-only cookies used to be necessary Cookies have an optional secure flag. It tells the browser to not send the cookie for a non-https request.

...users from http:// to https://. The reason was that most users will only enter a scheme-less domain like makandra.de into their location bar, which will default to http://makandra.de...

Important Work on this lesson in advisor mode. Learning goals You can explain how server-side validation of single fields works while the user is still filling out the...

...an explanation for anything here, tailored to what you already know. Just ask. 📄 Validating forms — server-side validation of single fields while the user types 📄 Switching form state — showing and...

...This lesson covers metaprogramming techniques and how to use them to build a domain-specific language (DSL), along with the price you pay in readability. Important Work on this lesson...

...exec) and explain why DSLs depend on this. You can explain what a domain-specific language is, and weigh its benefit — data that reads like prose — against its costs: code...

github.com

...in C, with much better performance (20-200x) than the version in the standard library, while being almost completely compatible...

github.com

Reads Active Record's validations and makes them available to live client side javascript

tech.puredanger.com

...that pops up as it’s a thing of beauty in a piece of software that usually is seen as highly unimportant, yet is the first thing you encounter when...

...taking commercial software for a spin...

roughtype.com

...fans of progress, of technology's inexorable march forward, will change their tune as soon as progress destroys something they care deeply about...

37signals.com

...Adobe a few days before the launch of their flagship product, what hope do smaller players hold...

The following two hints are taken from Github's Ruby style guide: If your regular expression mentions a lot of forward slashes, you can use the alternative delimiters %r(...), %r...

...complex, you can use the /x modifier to ignore whitespace and comments: regexp = %r{ start # some text \s # white space char (group) # first group (?:alt1|alt2) # some alternation end

github.com

You can hook into Slack when using Capistrano for deployment. The slackistrano gem does most of the heavy lifting for you. Its default messages are unobtrusive and can be adjusted...

When deploying, it posts to a Slack channel like this: How to integrate Integrating Slackistrano with Capistrano 3 is fairly simple. If you are not a Slack admin

...can reset the min-width. Say you have a simple grid layout: .container .first-item .second-item .third-item .container display: grid grid-template-columns: 100px 1fr 100px Your expectation...

...correct as the grid layout will try to do that: +---------+----------------------------+---------+ | | - 10 characters long | | +---------+----------------------------+---------+ However, if .second-item's content is too large to fit into the reserved space, it will...

...Doing that enables e.g. man in the middle attacks. If you accept only a single expired and known certificate, you are much less in trouble. Setup All the solutions described...

...below use a verify_callback for the request's OpenSSL::X509::Store where you can specify a lambda to adjust its verification response. Your callback must return either true or...

...table, two things happen: Rails tries to load all involved records in a huge single query spanning multiple database tables. The preloaded association list is filtered by the where condition...

...you only wanted to use the where condition to filter the containing model. The second case's behavior is mostly unexpected, because pre-loaded associations usually don't care about...

Element finding is a central feature of Capybara. Since #find is normally used to get elements from the current page and interact with them, it's a good thing that...

...some Capybara drivers (e.g. Selenium) will wait an amount of time until the expected element shows up. But if Capybara cannot #find it at all, you'll get an error...

By default, the mouse pointer is at location (0,0) in a Playwright suite. For newly added elements that cover (0,0), hovering events (like mouseenter) did not trigger...

This happens only when the mouse pointer was never moved and seems to be caused by the Chromium feature RenderDocument which Playwright disabled before 1.62.

When you need to find out in which kind of spec you are during run-time, it's definitely possible. It's a lot easier in RSpec 2+.

...consider this global before block where you'd want to run some code for specific specs only: config.before do # stuff that_fancy_method # more stuff end RSpec 2+

apidock.com

This is somewhat similar to the touch command of Linux: FileUtils.touch 'example.txt', :mtime => Time.now - 2.hours If you omit the :mtime the modification timestamp will be set to the current time...

keepachangelog.com

...maintain. There are some good practices for writing a changelog that adds value, please stick to these. Add a notice to the README's contribute section about the changelog

...this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## Unreleased - Added `Foo#foo` method. ## 1.0.0 - 2017-06-20 ### Breaking changes - Renamed `Foo...

github.com

...is a cron replacement. It runs as a lightweight, long-running Ruby process which sits alongside your web processes (Mongrel/Thin) and your worker processes (DJ/Resque/Minion/Stalker) to schedule recurring work at...

...particular times or dates. For example, refreshing feeds on an hourly basis, or send reminder emails on a nightly basis, or generating invoices once a month on the 1st...

Download buttons can be difficult to test, especially with Selenium. Depending on browser, user settings and response headers, one of three things can happen: The browser shows a "Save as...

...dialog. Since it is a modal dialog, we can no longer communicate with the browser through Selenium. The browser automatically downloads the file without prompting the user. For the test...