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...

Jasmine: Cleaning up the DOM after each test

Posted Over 1 year ago by Henning Koch.

Jasmine specs that work with DOM elements often leave elements in the DOM after they're done. This will leak...

Inspect and Debug CSS Flexbox and Grid Layouts by using the Layouts Tab in Dev Tools

Posted Over 1 year ago by Felix Eschey.

tl;dr In Chrome DevTools in the Layouts tab you have handy options to debug CSS Flexbox and Grid. Including...

Do not use unitless zeros in CSS calc functions

Posted Over 1 year ago by Arne Hartherz.
drafts.csswg.org

While in CSS zero is usually referenced without specifying a unit (e.g. padding: 0), you must not use a unitless...

Organizing custom Date(Time) formats

Posted Over 1 year ago by Niklas Hä..

Large Rails projects tend to define multiple custom ways to format Dates or DateTimes. This often leads to duplicated format...

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: Event Listener Breakpoints

Posted Over 1 year ago by Julian.

tl;dr In Chrome DevTools in the Sources tab you can activate Event Listener Breakpoints for debugging events. Example

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...

Chrome DevTools: Quick Bite - Store Element in Global Variable

Posted Over 1 year ago by Julian.

tl;dr In the Elements tab in the Chrome DevTools you can right click on an element and select Store...

ActiveType::Object: Be careful when overriding the initialize method

Posted Over 1 year ago by Jakob Scholz.
github.com

ActiveType::Object inherits from ActiveRecod::Base and is designed to behave like an ActiveRecord Object, just without the database...

Temporary solution for connection errors with rubygems

Posted Over 1 year ago by Jakob Scholz.

If you're experiencing that your bundle install command fails with an error message like this, rubygems.org might...

Debug flaky tests with an Unpoly observeDelay

Posted Over 1 year ago by Niklas Hasselmeyer.

Unpoly's [up-observe], [up-autosubmit] and [up-validate] as well as their programmatic variants up.observe() and up.autosubmit...

Rails: Validations of Dates, Numerics and Strings with ComparisonValidator

Posted Over 1 year ago by Julian.

tl;dr Since Rails 7+ you can use ComparisonValidator for validations like greater_than, less_than, etc. on dates, numerics...

Careful when using Time objects for generating ETags

Posted Over 1 year ago by Arne Hartherz.

You can use ETags to allow clients to use cached responses, if your application would send the same contents as...

Use capybara and not rspec matchers

Posted Over 1 year ago by Niklas Hä..

One rule of thumb I try to follow in capybara tests is using capybara matchers and not plain rspec matchers...

RubyMine: Find and Replace with Regex (Capture Groups and Backreferences)

Posted Over 1 year ago by Julian.

tl;dr In RubyMine you can use find and replace with capture groups (.*?) and backreferences $1 (if you have several...

SEO: The subtle differences of robots.txt disallow vs meta robots no-index

Posted Over 1 year ago by Dominik Schöler.
workingdraft.de

The robots.txt file and HTML tag can be used to control the behavior of search engine crawlers. Both have different...

Prefer using Dir.mktmpdir when dealing with temporary directories in Ruby

Posted Over 1 year ago by Emanuel.

Ruby's standard library includes a class for creating temporary directories. Similar to Tempfile it creates a unique directory name...

Rails: Comparison of Dates - before? and after?

Posted Over 1 year ago by Julian.

tl;dr Since Rails 6+ you can use before? and after? to check if a date/time is before or after...

Careful: `fresh_when last_modified: ...` without an object does not generate an E-Tag

Posted Over 1 year ago by Arne Hartherz.

To allow HTTP 304 responses, Rails offers the fresh_when method for controllers. The most common way is to pass...

JSON APIs: Default design for common features

Posted Over 1 year ago by Niklas Hä..

When you build a JSON API you need to come up with a style to represent attributes, pagination, errors or...

CSS: :is() pseudo selector

Posted Almost 2 years ago by Julian.

tl;dr The :is() pseudo selector - specificity of its most specific argument - matches against a comma-separated list of selectors...

CSS: :where() pseudo selector

Posted Almost 2 years ago by Julian.

tl;dr The :where() pseudo selector - zero specificity - matches against a comma-separated list of selectors. Example Compound selectors like...

Generating and streaming ZIP archives on the fly

Posted Almost 2 years ago by Arne Hartherz.

When your Rails application offers downloading a bunch of files as ZIP archive, you basically have two options: