The sprintf method has a reference by name format option: sprintf("% d : % f", { :foo => 1, :bar => 2 }) # => 1 : 2.000000
As an application exists, data accumulates. While you'll be loosely monitoring the main models' record count, some supportive database...
...find dead code in puppet projects. To use it, (as of now) it's best to get the latest version from git, as the last release is not yet on...
If you use a newer SSH key generated with the ED25519 algorithm instead of RSA (see Create a new SSH...
...is a fix to SafeBuffer#gsub. Note that it will only fix the $1 behavior, not give you a safe string in the end (see below). Example def test(input...
...really expect outside code (read: Gems) to not use $1 (and there is plenty, believe me) when calling gsub on an input that may be a SafeBuffer, you need to...
For each movie in MovieDB, we want to track which other movie it was inspired by. For...
...reject_if: :all_blank # Ignore the blank template record end class Image < ActiveRecord::Base belongs_to :gallery mount_uploader :teh_image, YourUploaderHere # Mount Carrierwave on attribute :teh_image end
...to automatically fix the whitespace, see below. (Note that this might lead to unexpected behaviour e.g. in Markdown documents.) The global git hooks live in $PREFIX/share/git-core/templates/hooks (where $PREFIX is probably...
Wondering what these numbers in the mount entries in /etc/fstab are meaning? The first number fs_freq When this field...
...of time, but it will always be retried at least a second time. This behavior allows with_scope to be patient, and it must be patient, as explained below.
This decision tree describes how to use the alt attribute of the element in various situations. For some types of...
...Use the attached Modularity below to add such a magical array to your model. Besides using the trait, you will need to implement two methods to synchronize the string array...
We recently encountered a problem with GlusterFS (7.x) when an application used the flock syscall on a GlusterFS path...
For my Gem Session project Holly I ran the Ironman of drag'n'drop implementations: Dragging in nested lists
When making cross-domain AJAX requests with jQuery (using CORS or xdomain or similar), you will run into issues with...
Note: Making a reverse proxy with nginx is much more straightforward. A reverse proxy is a "man in the middle...
...its mount path. It starts with /media/. Open a terminal and sudo su to become root. We require root for everything. Use dd to create an image of your encrypted...
CoffeeScript and JavaScript (ECMAScript) both have operators in and of. Each language use them for more than one purpose. There...
Rails comes with grouped_collection_select that appears to be useful, but isn't. As an alternative, consider the flat...
...which point the exception was thrown. def self.search_solr_with_exception_handling(*types, &block) begin search_solr_without_exception_handling(*types, &block) rescue Errno::ECONNREFUSED, Timeout::Error => e message = "Verbindung...
Two weeks ago, Cloudflare was struck by a global outage that lasted ~30 minutes. The incident was rooted on a...
We often do some HTTP requests to fetch the data we want to check for certain criteria. Testing this in...
Sometimes you might need to do some task in GitLab which would be tedious if you'd have to do...
The Oracle mysql client has an odd behavior if your server uses latin1 as default character-set-server. Command mysql --version mysql Ver 8.0.31-0ubuntu0.20.04.2 for Linux on x86...
...character-set utf8 and set the character set inside the session to circumvent this behavior. Better solutions Use MariaDB mysql client The MariaDB mysql client handles the --default-character-set...