Manage Linux services on the command line (Ubuntu)

Posted Over 3 years ago.

Ubuntu 18.04 uses systemd to manage services. There are basically two commands for listing all services and manipulating the state...

Migrate gem tests from Travis CI to Github Actions with gemika

Posted Over 3 years ago by Tobias Kraze.

We currently test most of our gems on Travis CI, but want to migrate those tests to Github Actions. This...

Debugging SPF records

Posted Over 3 years ago by Daniel Straßner.

While debugging a SPF record I found spf-record.de to be very helpful. it lists all IPs that are covered by...

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

Rails: How to list all validations on a model or an attribute

Posted Over 3 years ago.

If a model inherits from others or uses many concerns / traits, it might be hard to see in the code...

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

Workflow: How to use a key management service to encrypt passwords in the database

Posted Over 3 years ago by Emanuel.
news.ycombinator.com

This is an extract from the linked article. It shows an approach on how to implement encrypted passwords with the...

How to fix: Rails query logs always show lib/active_record/log_subscriber.rb as source

Posted Over 3 years ago by Arne Hartherz.

Rails 5.2+ supports "verbose query logs" where it shows the source of a query in the application log.

Service Worker series by GoMakeThings

Posted Over 3 years ago by Dominik Schöler.
gomakethings.com

Learn how to create offline applications with service workers. The amazing power of service workers Writing your first service worker...

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

Chrome Lighthouse

Posted Over 3 years ago.
developers.google.com

Chrome has a built-in utility to check performance and accessibility (and more) of your web app: Lighthouse.

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

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

Introducing GoodJob 1.0, a new Postgres-based, multithreaded, ActiveJob backend for Ruby on Rails

Posted Almost 4 years ago by Henning Koch.
island94.org

GoodJob is a new background worker gem. It's compatible with ActiveJob. We're huge fans of Sidekiq for its...

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

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

PostgreSQL: Difference between text and varchar columns

Posted Almost 4 years ago by Michael Leimstädtner.
postgresql.org

PostgreSQL offers three character types for your columns: character varying(n) (also called varchar or just string): Contents are limited...

How to use Active Job to decouple your background processing from a gem

Posted Almost 4 years ago.

In a web application you sometimes have tasks that can not be processed during a request but need to go...

Howto: Select2 with AJAX

Posted Almost 4 years ago by Florian Leinsinger.
select2.org

Select2 comes with AJAX support built in, using jQuery's AJAX methods. ... For remote data sources only, Select2 does not...