Designing HTML emails

Posted Almost 6 years ago by Dominik Schöler.
litmus.com

The 90s are calling: they want their tables back. Unfortunately, you need them all for laying out your HTML emails...

Using the Ruby block shortcut with arguments

Posted Almost 6 years ago by Dominik Schöler.
stackoverflow.com

Ruby has this handy block shortcut map(&:to_i) for map { |x| x.to_i }. However, it is limited to argument...

CSS: Using interaction media detection to disable hover styles for devices that have no hover

Posted Almost 6 years ago by Dominik Schöler.
caniuse.com

Since late 2015, all major browsers (still excluding Firefox) support pointing device media queries. These can be used to distinguish...

RSpec: Expect one of multiple matchers to match

Posted Almost 6 years ago by Henning Koch.
rspec.info

RSpec let's you chain a matcher with .or. The expectation will then pass if at least one matcher matches...

Printing background color of elements

Posted Almost 6 years ago by Natalie Zeumann.
developer.mozilla.org

Browsers' printing methods usually don't print background colors. In most cases this is the desired behavior, because you don...

Capistrano + Rails: Automatically skipping asset compilation when assets have not changed

Posted Almost 6 years ago by Dominik Schöler.
makandracards.com

In medium-sized to large Rails applications, asset compilation can take several minutes. In order to speed up deployment, asset...

CSS: Using the current text color for other color properties

Posted Almost 6 years ago by Dominik Schöler.
caniuse.com

There is a kinda secret, yet well supported CSS feature called currentColor. It's like a special CSS variable that...

Carrierwave: Built-in RSpec matchers

Posted Almost 6 years ago by Florian Leinsinger.
rubydoc.info

CarrierWave comes with some RSpec matchers which will make testing more comfortable. Let's say you have an Uploader like...

Rails: How to provide a public link in a mail

Posted Almost 6 years ago by Emanuel.

Lets say we have a user with a contract whereas contract is a mounted carrierwave file. Now we want to...

Generating test images on the fly via JavaScript or Ruby

Posted About 6 years ago by Arne Hartherz.
jsfiddle.net

When you need test images, instead of using services like lorempixel or placehold.it you may generate test images yourself.

How to resize your boot partition when there is an encrypted partition after it

Posted About 6 years ago by Arne Hartherz.

Boot partitions from installations prior to the 16.04 era are terribly small. When you install updates and encounter errors due...

Writing strings as Carrierwave uploads

Posted About 6 years ago by Arne Hartherz.

When you have string contents (e.g. a generated binary stream, or data from a remote source) that you want to...

Chrome: Making high-resolution website screenshots without add-ons

Posted About 6 years ago by Henning Koch.

If you want to make a screenshot of a website that works well in print or on a high-DPI...

Capybara: A step for finding images with filename and extension

Posted About 6 years ago by Emanuel.

This cucumber step is useful for testing an image (looking at the src of the image). Then(/^I should see...

Carrierwave: Deleting files outside of forms

Posted Over 6 years ago by Dominik Schöler.

TL;DR Use user.update!(remove_avatar: true) to delete attachments outside of forms. This will have the same behavior as...

CSS: Giving text lines a background-color (with configurable line padding and margin)

Posted Over 6 years ago by Dominik Schöler.
geoffmuskett.com

wrap the text with a span use line-height for the spacing between lines ("margin")

Spreewald: Content-Disposition not set when testing a download's filename

Posted Over 6 years ago by Emanuel.

You are not using javascript tests The file is served from a public folder (not via controller) Problem description...

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...

A Theme Switcher

Posted Over 6 years ago by Henning Koch.
inclusive-components.design

Hack to implement an inverted "night mode" theme with a few lines of CSS. Colors in images are preserved.

Vagrant: create entry for box in .ssh/config

Posted Over 6 years ago by Daniel Straßner.

If you want to ssh into your vagrant box without switching into the project directory and typing vagrant ssh, you...

Deleting stale Paperclip attachment styles from the server

Posted Over 6 years ago by Dominik Schöler.

Sometimes you add Paperclip image styles, sometimes you remove some. In order to only keep the files you actually need...

ImageMagick: How to auto-crop and/or resize an image into a box

Posted Over 6 years ago by Arne Hartherz.

ImageMagick can automatically crop surrounding transparent pixels from an image: convert input.png -trim +repage output.png

Caution: Carrierwave has your file three times (temporarily)

Posted Over 6 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 define height of a div as percentage of its variable width

Posted Almost 7 years ago by Judith Roth.

This is useful if, for example, you want to use a background-image that has to scale with the width...