Be careful to use correct HTTP status codes for maintenance pages

Posted Over 6 years ago by Henning Koch.

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

Posted Over 6 years ago by Henning Koch.

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

Posted Over 6 years ago by Michael Leimstädtner.

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

Posted Over 6 years ago by Emanuel.

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

Posted Over 6 years ago by Henning Koch.
reactarmory.com

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

Posted Over 6 years ago by Andreas Robecke.

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

Posted Almost 7 years ago by Andreas Robecke.
api.rubyonrails.org

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

Posted Almost 7 years ago by Arne Hartherz.

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)

Posted Almost 7 years ago by Dominik Schöler.
github.com

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

Posted Almost 7 years ago by Emanuel.

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

Posted Almost 7 years ago.

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

Posted Almost 7 years ago by Henning Koch.

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

Posted Almost 7 years ago by Dominik Schöler.

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

Posted About 7 years ago by Natalie Zeumann.
jetbrains.com

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)

Posted About 7 years ago.
github.com

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

Posted About 7 years ago by Dominik Schöler.

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

Posted About 7 years ago by Arne Hartherz.

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

Posted About 7 years ago by Henning Koch.

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

Posted About 7 years ago by Kim Klotz.

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

Posted About 7 years ago.

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

Posted About 7 years ago by Emanuel.

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

Posted About 7 years ago.

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

Posted About 7 years ago by Daniel Straßner.

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

Posted About 7 years ago by Tobias Kraze.

There are various ways to run external commands from within Ruby, but the most powerful ones are Open3.capture3 and Open3.popen3...