When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm
The attached article examines what the percent unit (%) is relative to in CSS The article does a great job of...
Ruby 3.0 introduced a breaking change in how it treats keyword arguments. There is an excellent blog post on the...
When you have a hex color code, you can easily convert it into its RGB values using plain Ruby.
https://tableconvert.com/ is an online tool to convert tables between different formats (e.g. json, markdown, csv).
We prefer to run our end-to-end tests with headless Chrome. While it's a very stable solution overall...
When your Rails application server raises error, Capybara will fail your test when it clears the session after the last...
Browsers blocks abusable JavaScript API calls until the user has interacted with the document. Examples would be opening new tab...
In Ruby (almost) everything is an Object. While this enables a lot of powerful features, this concept might be confusing...
By default parallel_tests will spawn as many test processes as you have CPUs. If you have issues with flaky...
The pages […] allow you to see different types of mixed content and test how they behave in your browser. The...
Recently I made an upgrade from Bootstrap 3 to Bootstrap 4 in a bigger project. Here are some tips how...
Rails 6 includes a WYSIWYG editor, Action Text. It works out of the box quite well, but chances are that...
Rails supports alert and notice as default flash types. This allows you to use these keys as options in e.g...
I just finished migrating a project from the Asset Pipeline to Webpacker, this is what my diff to master looks...
In my experience, the most common sources of memory leaks are APIs like these: addEventListener. This is the most common...
TinyMCE is a WYSIWYG editor which is quite customizable. Add a custom button to the tinyMCE toolbar and tell tinyMCE...
When testing with Cucumber / Caypbara, iframes are ignored, so you can't interact with them. To interact with your iframe...
Ruby's String#split returns an array of substrings from the given string. Usually, this is missing the split characters...
Headless Chrome is a way to run the Chrome browser without a visible window. Configuring Capybara Configure the Capybara driver...
Feature Queries (Edge 12+): Similar to @media queries, @supports blocks can be scoped to browsers that support a given declaration...
Why improve your code reviews? Improving code review technique helps your reviewer, your team, and, most importantly: you.
This card is mainly an explanation how variable fonts work in CSS, not necessarily a recommendation to actually use them...
Git diffs show the surrounding contexts for diff hunks. It does so by applying regular expressions to find the beginning...