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

makandra dev

When a Rails controller action should handle both HTML and JSON responses, do not use request.xhr? to decide that. Use...

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

This is painful. Consider using Microsoft Office or switching careers. If you need to write < 20 letters consider doing it...

web.archive.org

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

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

github.com

When writing XLSX files, there are gems like rubyXL or axlsx. While they do offer features like formatting or graphs...

If your Angular app has some decent complexity, it will not be easy to use UI Router straight away. Here...

Checking if a JavaScript value is of a given type can be very confusing: There are two operators typeof and...

If you use awesome and make a Slack call, you'll constantly have an overlay window pop up taking over...

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

makandra dev

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

Browsers support different types of redirects. Be very careful with these status codes: 301 Moved Permanently 308 Permanent Redirect

Slides for Henning's talk on Sep 21st 2017. Understanding sync vs. async control flow Talking to synchronous (or "blocking...

If you are using PDFKit / wkhtmltopdf, you might as well want to use custom fonts in your stylesheets. Usually this...

reactarmory.com

The linked article shows how to exploit websites that include unsanitized user input in their CSS. Although the article often...

makandra dev
inclusive-components.design

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

askubuntu.com

While the hardware mute button of my Lenovo x230 worked on Ubuntu 14.04 out of the box, it does not...

Let's say you have a form that you render a few times but you would like to customize your...

There are several gems that make it easy to read and process xlsx files. Parsing the entire file at once...

gist.github.com

Here is some JavaScript code that allows you to click the screen and get the clicked element's text contents...

You should prefer native promises to jQuery's Deferreds. Native promises are much faster than their jQuery equivalent. Native promises...