JavaScript: Detecting the end of native smooth scrolling

Posted 12 months ago by Henning Koch.

When you use native smooth scrolling there is no built-in method to detect the end of the scrolling animation...

Rails: Assigning associations via HTML forms

Posted 12 months ago by Emanuel.

Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...

HTTP headers can only transport US-ASCII characters safely

Posted About 1 year ago by Henning Koch.

HTTP header values must only contain low-ASCII (7-bit) characters for safe transport. From RFC 7230: Historically, HTTP has...

How to read the current breakpoint tier(s) in JavaScript

Posted Over 1 year ago by Dominik Schöler.

To read the current breakpoint tier in JavaScript, employ this CSS: :root { --current-breakpoint-tier: xs; @media (min-width: $screen...

Jasmine: Mocking ESM imports

Posted Over 1 year ago by Henning Koch.

In a Jasmine spec you want to spy on a function that is imported by the code under test. This...

Bookmarklet: cards Markup Link Bookmarklet

Posted Over 1 year ago by Daniel Straßner.

The cards editor has a feature "Cite other card" to create links to other cards in the same deck as...

Using path aliases in esbuild

Posted Over 1 year ago by Tobias Kraze.

In esbuild, you usually import other files using relative paths: import './some-related-module' import `../../utils/some-utility-module` import `../../../css/some-css.sass` This is totally fine...

Jasmine: Creating DOM elements efficiently

Posted Over 1 year ago by Henning Koch.

Jasmine specs for the frontend often need some DOM elements to work with. Because creating them is such a common...

Sass: get rid of deprecation warnings in dependencies

Posted Over 1 year ago by Daniel Straßner.

TLDR: sass >= 1.35.0 has the option quietDeps to silence deprecation warnings from dependencies. quietDeps: If true, the compiler must not...

Chrome DevTools: DOM Breakpoints - Breakpoints on HTML Elements

Posted Over 1 year ago by Julian.

tl;dr In Chrome DevTools in the Elements tab or in Firefox in the Inspector tab you can right click...

JavaScript: Testing whether the browser is online or offline

Posted Almost 2 years ago by Henning Koch.

You can use the code below to check whether the browser can make connections to the current site: await isOnline...

Show a JS fiddle in fullscreen

Posted Almost 2 years ago by Emanuel.

If you have a JS fiddle, you can open it in fullscreen by appending /show to the URL. Example: https://...

Capybara: Most okayest helper to download and inspect files

Posted Almost 2 years ago by Henning Koch.

Testing file download links in an end-to-end test can be painful, especially with Selenium. The attached download_helpers.rb provides...

JavaScript: New Features in ES2021

Posted About 2 years ago by Julian.

tl;dr With ES2021 you now can use str.replaceAll(), Promise.any(), logical assignment operators, numeric separators and WeakRef on all major...

JavaScript: Working with Query Parameters

Posted About 2 years ago by Julian.

tl;dr: Use the URLSearchParams API to make your live easier if you want to get or manipulate query parameters...

Jasmine: Fixing common errors during initialization

Posted About 2 years ago by Henning Koch.

Due to the way we setup Jasmine tests in our projects, you may run into various errors when Jasmine boots...

How to access Chrome Devtools when running JavaScript tests via CLI

Posted About 2 years ago by Michael Leimstädtner.

While we are used to run our JavaScript tests on a test page within our Browser, it's also possible...

Integrating ESLint

Posted About 2 years ago.

To ensure a consistent code style for JavaScript code, we use ESLint. The workflow is similar to integrating rubocop...

How to add esbuild to the rails asset pipeline

Posted Over 2 years ago.

This are the steps I needed to do to add esbuild to an application that used the vanilla rails asset...

esbuild: Make your Rails application show build errors

Posted Over 2 years ago by Arne Hartherz.

Building application assets with esbuild is the new way to do it, and it's great, especially in combination with...

JavaScript Sentry: How to check if errors will be reported

Posted Over 2 years ago by Dominik Schöler.
stackoverflow.com

One really simple way to check whether JavaScript Sentry integration was successful (raven-js or @sentry/browser), is to create an...

Selector for finding the currently selected option in a <select> tag

Posted Over 2 years ago by Arne Hartherz.

Use option:checked to find the currently selected option: select.querySelector('option:checked') Yes, :checked, not :selected. This is the same...

The TCF 2.0 (Tranparency and Consent Framework) standard, and what you should know about it

Posted Over 2 years ago by Tobias Kraze.

The Interactive Advertising Bureau (IAB) is a European marketing association which has introduced a standard how advertising can be served...

Google Chrome now has a JavaScript bundle visualizer

Posted Over 2 years ago by Dominik Schöler.
umaar.com

Similar to the Webpack Bundle Analyzer, Chrome's new Lighthouse feature … … shows a visualisation of your JavaScript bundles. It's...