makandra dev

While renaming a file sometimes feels like "dropping its history", that is not true: Just use git log --follow on...

rspec.info

rspec >= 3.1 brings a method and_wrap_original. It seems a bit complicated at first, but there are use cases...

When dealing with external data sources, you may have to deal with improperly encoded strings. While you should prefer deciding...

Browsers usually cache website content in order to provide the user with faster responses. Examples are returning to a website...

makandra dev

When a Ruby version gem has a letter in its version number, it is considered a pre-release:

The usual way to build a relation in a ActiveSupport::Concern is this: module MyModule extend ActiveSupport::Concern

jetbrains.com

In RubyMine folders can be excluded from search, navigation etc. by marking it as excluded. You might sometimes wish to...

When storing files for lots of records in the server's file system, Carrierwave's default store_dir approach may...

When deleting a record in your Rails app, Carrierwave automatically takes care of removing all associated files. However, the file...

If your Webpack build is slow, you can use the Speed Measure Plugin for Webpack to figure out where time...

Sometimes you want to load code on demand. For instance, when a a large library is only used on a...

makandra dev

Webpack builds can take a long time, so we only want to compile when needed. This card shows what will...

docs.gitlab.com

Use rules to include or exclude jobs in pipelines. Rules are evaluated in order until the first match. When a...

Installing gems on a server that has no access to the internet (especially rubygems.org) requires to bundle the gems into...

Generate a password htpasswd -Bn firstname.lastname This will ask you for a password and use bcrypt (-B, more secure) and...

When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm

To attach files to your records, you will need a new database column representing the filename of the file...

I use the TypeScript compiler for this, since its output is more minimal than Babel's. The following will transpile...

ruby-lang.org

Ruby 3.0 introduced a breaking change in how it treats keyword arguments. There is an excellent blog post on the...

When you have a hex color code, you can easily convert it into its RGB values using plain Ruby.

tableconvert.com

https://tableconvert.com/ is an online tool to convert tables between different formats (e.g. json, markdown, csv).

We prefer to run our end-to-end tests with headless Chrome. While it's a very stable solution overall...

When your Rails application server raises error, Capybara will fail your test when it clears the session after the last...

makandra dev

When your application is open for public sign up and sends out transactional e-mails to a large number of...