Be careful to use correct HTTP status codes for maintenance pages
When your public-facing application has a longer downtime for server maintenance or long migrations, it's nice to setup...
Async control flow in JavaScript: Promises, Microtasks, async/await
Slides for Henning's talk on Sep 21st 2017. Understanding sync vs. async control flow Talking to synchronous (or "blocking...
How to fix broken font collisions in wkhtmltopdf
If you are using PDFKit / wkhtmltopdf, you might as well want to use custom fonts in your stylesheets. Usually this...
How to add a custom dictionary to Ruby Mine
Download the dictionary from http://www.winedt.org/dict.html, e.g. http://www.winedt.org/dict/de_neu.zip unzip de_neu.zip mkdir ~/Documents/dic iconv -f UTF-16 -t...
How to exploit websites that include user input in their CSS
The linked article shows how to exploit websites that include unsanitized user input in their CSS. Although the article often...
Rails: render a template that accepts a block by using the layout option of render
Let's say you have a form that you render a few times but you would like to customize your...
Rails: wrap_parameters for your API
Rails 5 (don't know about the others) comes with an initializer wrap_parameters.rb. Here you can tell rails to wrap...
How to make Webpacker compile once for parallel tests, and only if necessary
Webpack is the future. We're using it in our latest Rails applications. For tests, we want to compile assets...
Caution: Carrierwave has your file three times (temporarily)
When storing a file with Carrierwave, it is always cached prior to actually storing it (to support form roundtrips).
How to: Rails cache for individual rspec tests
Rails default config uses the ActiveSupport::Cache::NullStore and disables controller caching for all environments except production: config.action_controller.perform_caching = false...
How to define height of a div as percentage of its variable width
This is useful if, for example, you want to use a background-image that has to scale with the width...
Middleman: Use pretty URLs without doubling requests
By default Middleman generates files with a .html extension. Because of this all your URLs end in /foo.html instead of...
Middleman configuration for Rails Developers
Middleman is a static page generator that brings many of the goodies that Rails developers are used to.
Rubymine provides a visual merge conflict resolution tool
RubyMine provides a visual tool for resolving merge conflicts locally. Follow Git > Resolve Conflicts in the context menu to open...
How to use Parallel to speed up building the same html partial multiple times (for different data)
The parallel-gem is quite easy to use and can speed up rendering time if you want to render the...
Solved: Element inside overflow:scroll container cannot be scrolled on iOS when dragged by a contained iframe
Imagine the following HTML structure, where the scrolling container has overflow-y: scroll: +--scrolling container+-+ | | | +-child element+----+ | | | ++iframe++ | | | | | | | | | | | | | | +-----------------------+ | | | | <-- actually cut...
How to disable Chrome's save password bubble for Selenium tests
When filling out forms in Selenium tests, Chrome shows the (usual) bubble, asking to store those credentials. While the bubble...
CSS: Don't target multiple vendor-prefixed pseudo-elements in a single rule
Some pseudo-elements need to be addressed with vendor prefixes. E.g. ::selection is not supported by Firefox, you need to...
How to make http/https requests yourself with nc/telnet/openssl
Sometimes you want/have to send specific http(s) requests. You can do that easy with curl or just write the...
How to view Image Metadata on the Linux Command Line with ImageMagick
ImageMagick has a command line tool called identify which can read image metadata: >identify -verbose DSC00136.JPG Image: DSC00136.JPG Format: JPEG...
Vim read-only option
You can start vim with a read-only option. This prevents making accidentally changes in files you don't want...
Beware: Nested Spreewald patiently blocks are not patient
Note: The behaviour of Spreewald's within step is as described below for version < 1.9.0; For Spreewald >= 1.9.0 it is...
Haml: Prevent whitespace from being stripped in production
This is not an issue in newer versions of HAML (starting with 5.0.0), as the ugly-option was removed...
Running external commands with Open3
There are various ways to run external commands from within Ruby, but the most powerful ones are Open3.capture3 and Open3.popen3...