Creating a sample video with ffmpeg

Posted About 1 year ago by Martin Schaflitzl.

If you need a sample video with certain properties for a test you can create one using ffmpeg.

Story Checklist Template

Posted About 1 year ago by Felix Eschey.

This is an story checklist I use to work on stories. For this purpose I extracted several cards related to...

Rails Partials

Posted About 1 year ago by Niklas Hä..

Rails partials have a lot of "hidden" features and this card describes some non-obvious usages of Rails Partials.

How to turn images into inline attachments in emails

Posted About 1 year ago by Klaus Weidinger.

Not all email clients support external images in all situations, e.g. an image within a link. In some cases, a...

Carrierwave: Custom file validations inside custom Uploaders

Posted About 1 year ago by Jakob Scholz.

Carrierwave's BaseUploader can have some validations that you can use by overriding a certain method, which's expected name...

Rails: Encrypting your database information using Active Record Encryption

Posted About 1 year ago by Emanuel.

Since Rails 7 you are able to encrypt database information with Active Record. Using Active Record Encryption will store an...

git: find the version of a gem that releases a certain commit

Posted About 1 year ago by Daniel Straßner.

Sometimes I ran across a GitHub merge request of a gem where it was not completely obvious in which version...

RSpec: How to compare ISO 8601 time strings with milliseconds

Posted Over 1 year ago by Emanuel.

Rails includes milliseconds in Time / DateTime objects when rendering them as JSON: JSON.parse(User.last.to_json)['created_at'] #=> "2001-01-01...

How to kill a Rails development server by force

Posted Over 1 year ago by Klaus Weidinger.

Sometimes, the rails dev server doesn't terminate properly. This can for example happen when the dev server runs in...

Heads up: expect(object).to receive(:method_name) does not execute the original implementation of the method

Posted Over 1 year ago by Tanja.

Let's assume that we have a model Movie that registers a callback function when a new instance of Movie...

Spreewald: patiently blocks must not change variables from the surrounding scope

Posted Over 1 year ago by Henning Koch.

I recently enjoyed debugging a Cucumber step that tried to be retryable using a patiently block: Then /^"([^"]*)" should( not)? be...

Why Sidekiq Jobs should never be enqueued in an `after_create` or `after_save` callback

Posted Over 1 year ago by Tanja.

When an object is created / updated, various callbacks are executed in this order: before_validation after_validation before_save

Ruby object equality

Posted Over 1 year ago by Daniel Straßner.
ruby-doc.org

TLDR if you define a equality method for a class you must also implement def hash. Ruby has a lot...

Timecop: reset after each test

Posted Over 1 year ago by Daniel Straßner.

Timecop is a great gem to set the current time in tests. However, it is easy to introduce flakyness to...

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

Heads up: network requests `Kernel#open` are not mocked with VCR

Posted Over 1 year ago by Michael Leimstädtner.

We usually rely on VCR and WebMock to prevent any real network connection when running our unit tests.

Destructors for async Unpoly compilers

Posted Over 1 year ago by Arne Hartherz.

Usually, Unpoly compiler destructors are returned from the compiler function. However, when using async compiler functions, you can not register...

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

Rails: Use STI in Migration

Posted Over 1 year ago by Julian.

tl;dr You should decouple migrations from models by embedding models into the migration. To use STI in this scenario...

How to see how many inotify instances are used by each process

Posted Over 1 year ago by Martin Schaflitzl.

As a developer you may have many tools watching your project for changes: Your IDE, Webpack, Guard, etc. This is...

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