Ruby has this handy block shortcut map(&:to_i) for map { |x| x.to_i }. However, it is limited to argument...
TL;DR Append your locale keys with _html to have them marked as html_safe and translate them with = t...
When your application is running on a multi-server setup, application logs are stored per server (unless you choose a...
When your JavaScript bundle is so massive that you cannot load it all up front, I would recommend to load...
You know that you can use jQuery's text() to get an element's contents without any tags.
For outputting a given String in HTML, you mostly want to replace line breaks with or tags.
Lets say we have a user with a contract whereas contract is a mounted carrierwave file. Now we want to...
When you need test images, instead of using services like lorempixel or placehold.it you may generate test images yourself.
Rails offers a way to prepend (or append) view paths for the current request. This way, you can make the...
When you have string contents (e.g. a generated binary stream, or data from a remote source) that you want to...
Form fields can be rendered as noneditable by setting the disabled or the readonly attribute. Be aware of the differences...
If you want to make a screenshot of a website that works well in print or on a high-DPI...
When a Rails controller action should handle both HTML and JSON responses, do not use request.xhr? to decide that. Use...
TL;DR Use user.update!(remove_avatar: true) to delete attachments outside of forms. This will have the same behavior as...
This is painful. Consider using Microsoft Office or switching careers. If you need to write < 20 letters consider doing it...
When making requests using curl, no cookies are sent or stored by default. However, you can tell curl to re...
You should avoid using application models in your migrations. But how else could you create records in a migration?
When you print (or print preview) and elements are cut off (e.g. after 1st page, or "randomly") you should check...
By default, browsers will not wrap text at syllable boundaries. Text is wrapped at word boundaries only. This card explains...
Summary: Don't add chromedriver-helper to the Gemfile the executables might break your tests in projects where chromedriver-helper...
We're usually running Ubuntu LTS versions. Sometimes newer hardware requires packages from more recent Ubuntu releases that only come...
Checking if a JavaScript value is of a given type can be very confusing: There are two operators typeof and...
An end-to-end test (E2E test) is a script that remote-controls a web browser with tools like Selenium...
When your public-facing application has a longer downtime for server maintenance or long migrations, it's nice to setup...