PostgreSQL: Importing dumps created with newer versions

Posted Over 3 years ago by Daniel Straßner.

When loading a database dump created with pg_dump into your database, you might run into an error like

Rails: How to restore a postgres dump from the past

Posted Over 3 years ago by Emanuel.

It sometimes happen that a database dump, that would want to insert into your development database, does not match the...

How to implement simple queue limiting/throttling for Sidekiq

Posted Over 3 years ago by Arne Hartherz.

The sidekiq-rate-limiter gem allows rate-limiting Sidekiq jobs and works like a charm. However, it needs to be...

VCR and the webdrivers gem

Posted Over 3 years ago by Niklas Hä..

If you're using the webdrivers gem and VCR together, depending on your configuration, VCR will yell at you regulary...

How to include Sidekiq job IDs in Rails logs

Posted Over 3 years ago by Arne Hartherz.

When logging in Rails, you can use the log_tags configuration option to add extra information to each line, like...

How to generate GIDs from an ActiveRecord scope

Posted Over 3 years ago by Arne Hartherz.

ActiveRecord provides the ids method to pluck ids from a scope, but what if you need to pluck Global IDs...

Ruby: How to determine the absolute path relative to a file

Posted Over 3 years ago by Emanuel.

If you want to get the path of a file relative to another, you can use the expand_path method...

Chrome: Using browser notifications

Posted Over 3 years ago by Dominik Schöler.

Google Chrome disables Notifications for insecure origins (i.e. those using HTTP). Only http://localhost is considered secure.

CSS variables aka CSS Custom Properties

Posted Over 3 years ago by Dominik Schöler.

CSS variables are very different from preprocessor variables. While preprocessors use variables to compile a static piece of CSS, CSS...

How does Sentry group exceptions?

Posted Over 3 years ago by Tobias Kraze.

When you use Sentry to monitor exceptions, an important feature is Sentry's error grouping mechanism. This will aggregate similar...

Clean your Rails routes: grouping

Posted Over 3 years ago by Florian Leinsinger.
medium.com

In Ruby on Rails, all the routes of a given application can be found within the config/routes.rb file.

Ruby: Appending lines to a file in sync

Posted Over 3 years ago by Emanuel.

When writing some logs to a file, that don't use Ruby's logger utility, it is often useful to...

Parallel cucumber: How to pass in cucumber arguments

Posted Over 3 years ago by Emanuel.

Here is an example with the --tags option. You need to wrap them inside --cucumber-options option of parallel_cucumber...

Rails: How to get the ordered list of used middlewares

Posted Over 3 years ago by Emanuel.

Rails middlewares are small code pieces that wrap requests to the application. The first middleware gets passed the request, invokes...

How to check if a file is a human readable text file

Posted Over 3 years ago by Jakob Scholz.

Ruby's File class has a handy method binary? which checks whether a file is a binary file. This method...

PostgreSQL: How to use with_advisory_lock to prevent race conditions

Posted Over 3 years ago.

If you want to prevent that two processes run some code at the same time you can use the gem...

How to cycle through grep results with vim

Posted Over 3 years ago by Michael Leimstädtner.
github.com

grep is the go-to CLI tool to accomplish tasks like filtering large files for arbitrary keywords. When additional context...

How to migrate CoffeeScript files from Sprockets to Webpack(er)

Posted Over 3 years ago by Michael Leimstädtner.

If you migrate a Rails application from Sprockets to Webpack(er), you can either transpile your CoffeeScript files to JavaScript...

Vortrag: Content Security Policy: Eine Einführung

Posted Over 3 years ago by Tobias Kraze.

CSP hat zum Ziel einen Browser-seitigen Mechanismus zu schaffen um einige Angriffe auf Webseiten zu verhindern, hauptsächlich XSS...

Sentry: Different ways of deferring notifications for an issue

Posted Almost 4 years ago by Michael Leimstädtner.

We use Sentry to be informed about different kinds of issues. One of the key features is that you are...

Automatically validating dependency licenses with LicenseFinder

Posted Almost 4 years ago by Dominik Schöler.

"Open-source software (OSS) is great. Anyone can use virtually any open-source code in their projects." Well, it depends...

ActiveRecord: String and text fields should always validate their length

Posted Almost 4 years ago by Henning Koch.

If you have a :string or :text field, you should pair it with a model validation that restricts its length...

How to prevent Nokogiri from fixing invalid HTML

Posted Almost 4 years ago by Arne Hartherz.

Nokogiri is great. It will even fix invalid HTML for you, like a browser would (e.g. move block elements out...

FactoryBot: Traits for enums

Posted Almost 4 years ago by Florian Leinsinger.
github.com

FactoryBot allows to create traits from Enums since version 6.0.0 The automatic definition of traits for Active Record enum attributes...