External contentAuto-destruct in 60 days

Unpoly 0.31.0 released

Compatible changes

  • Drawers are now a built-in modal flavor! Use the [up-drawer] attribute to open page fragements
    in a modal drawer that slides in from the edge of the screen.

Breaking changes

External contentRepeats

Github Cheat Sheet

All the hidden and not hidden features of Git and GitHub.


Git: Show commits that have touched specific text in a file

If you want to find the commits that touched a specific text in a file, use git log -S 'text in the code' -- path/to/file.

Here is an example, where the move of the convert_number_column_value(value) method in active record is traced (simplified output):

git log -n 1 --pretty=oneline -S 'convert_number_column_value(value)' -- activerecord/lib/active_record/base.rb
ceb33f84933639d3b61aac62e5e71fd087ab65ed Split out most of the AR::Base code into separate modules :cake:

git show ceb33f84933639d3b61aac62e5e71fd087ab65ed…

Debugging flickering VCR tests

We often use VCR to stub external APIs. Unfortunately VCR can have problems matching requests to recorded cassettes, and these issues are often hard to debug.

VCR's error messages mostly look like this and are not very helpful:

An HTTP request has been made that VCR does not know how to handle:

VCR fails if the request does not exactly look like the request it has recorded. If the request is d…


How to define constants with traits

This is pretty much like defining subclasses through traits with the Modularity gem.

module MyConstantTrait
  as_trait do
    self::MY_CONSTANT = 'hello universe'

This would set MY_CONSTANT for any class using the trait.

Of course you can also use parameters (for logic or for setting values, like here):

module ValuesTrait
  as_trait do |*args|
    self::VALUES = args

class Foo
  does 'values', :f...

Styling SVGs with CSS only works in certain conditions

SVG is an acronym for "scalable vector graphics". SVGs should be used whenever an image can be described with vector instructions like "draw a line there" or "fill that space" (they're not suited for photographs and the like). Benefits are the MUCH smaller file size and the crisp and sharp rendering at any scale.

It's a simple, old concept brought to the web – half-heartedly. While actually all browsers pretend to support SVG, some barely complex use cases get you beyond common browser support.

In the bas…

Repeatedly execute a bash command and observe its output

You can have a command repeatedly executed and the output displayed. This is useful e.g. for monitoring file system changes with ls, but has many more applications.
The update frequency is controlled by the -n argument (default: 2s), which is locale-specific; i.e. you might need to use a comma as delimiter.

  > watch -n 1.5 ls
External content

tesseract.js: Pure Javascript OCR for 62 Languages

This might be relevant for us since we're often managing customer documents in our apps.

I played around with the library and this is what I found:

  • A 200 DPI scan of an English letter (500 KB JPEG) was processed in ~6 seconds on my desktop PC. It does the heavy lifting in a Web worker so you're rendering thread isn't blocked.
  • It detected maybe 95% of the text flawlessly. It has difficulties with underlined text or tight table borders.
  • When you feed …

Git: See more context in a diff

Using the -U parameter you can change how many lines are shown above and below a changed section.

E.g. git diff -U10 will show 10 lines above and below.

How to remove cloud init from ubuntu

If you're trying to start a cloud-init based Ubuntu VM with KVM you will suffer long boot times and confusing output on the terminal. If you want to get rid of it you need to remove cloud-init.

  1. wait until the VM boots
  2. login
  3. echo 'datasource_list: [ None ]' | sudo -s tee /etc/cloud/cloud.cfg.d/90_dpkg.cfg
  4. sudo apt-get purge cloud-init
  5. reboot
External contentRepeats

Taking screenshots in Capybara

Capybara-screenshot can automatically save screenshots and the HTML for failed Capybara tests in Cucumber, RSpec or Minitest.

Requires Capybara-Webkit, Selenium or poltergeist for making screenshots. They're saved into $APPLICATION_ROOT/tmp/capybara

The attached files contain config for cucumber integration and a Then show me a screenshot step.

Creating icon webfonts offers a free app to build custom icon webfonts. It offers downloads as webfont set (.eot, .ttf, .woff, .woff2) or as icon set of SVG and/or PNG and many more file types, or even SVG sprites.

From my experience, the frontend developer should create the font, and not the designer. There are many tweaks required during font development, and routing changes over the designer imposes just too much overhead.


  • Remove color from monochrome icons (Edit icon > Drop > Remove color). Do NOT remove color from bicolor icons. …

How to "git diff" with a graphical diff tool

If you are fine with the default console diff most of the time but only sometimes want to use an external tool for viewing a diff, you can use git difftool.

E.g. viewing git diff with meld:

git difftool --tool=meld

For each file in the diff you will be asked if you want to view it using meld.

Configure how VCR matches requests to recorded cassettes

VCR lets you configure how it matches requests to recorded cassettes:

In order to properly replay previously recorded requests, VCR must match new
HTTP requests to a previously recorded one. By default, it matches on HTTP
method and URI, since that is usually deterministic and fully identifies the
resource and action for typical RESTful APIs.

You can customize how VCR matches requests using the :match_requests_on cassette option.

There are number of predefine…

Auto-destruct in 48 days

Updated: Lazy-loading images

Added hint about how to react on image load, how to listen to that event.

Ubuntu MATE: Custom time format for clock panel widget

  • Run dconf-editor (as your user)
  • Go to org / mate / panel / objects / clock / prefs
  • Change the key format to custom
  • Change the key custom-format to a strftime format string

A good, space-saving format string for German users is %d.%m. %H:%M. This shows the current date, month, hour and minute (e.g. 24.12. 23:59).

Beware of rails' reverse_order!

#reverse_order does not work with complex sorting constraints and may even silently create malformed SQL for rails < 5.

Take a look at this query which orders by the maximum of two columns:

Page.order('GREATEST(pages.published_from_de, pages.published_from_en) DESC').to_sql
# => SELECT "pages".* FROM "pages" ORDER BY GREATEST(pages.published_from_de, pages.published_from_en) DESC

Rails 4

Rails 4 will not immediately raise but creates malformed SQL when trying to use reverse_order on this query:

3209 cards