Search_spinner Cross_grey Magnifier

Search syntax

  • Search for repeating cards with repeats:yes
  • Search for unfinished cards with unfinished:yes
  • Search for cards in a certain topic with topic:"name"
  • Search for phrases with "a phrase"
  • Exclude a word from search: -word
  • Exclude a phrase from search: -"a phrase"
  • Exclude a topic from search: -topic:"name"

Upgrade from Ruby 1.8.7 to 2.1.5 – an incomplete guide

Issues you may encounter:

  • Set the ruby version within your .ruby-version file to 2.1.5
  • Remove gem ruby-debug and use e.g. byebug
  • Remove gem oniguruma
  • Remove gem fastercsv
  • Replace gem mysql with mysql2
  • Update gem capistrano 2.12.0 to ~>2.12 when bound for Ruby 1.8.7 and remove obsolete explicite Gemfile entries for net-scp and net-ssh if present.
  • Update gem andand
  • Update gem parallel_tests (0.8.x to 1.6.x)
  • Downdgrade database_cleaner from 1.4.x to 1.2.0
  • Use new lambda syntax: change `la…

Spreewald: Click on an element with a CSS selector

Spreewald 1.4.0 comes with this step:

When I click on the element ".sidebar"

We recommend to define a selector_for method in features/support/selectors.rb so you can refer to the selector in plain English:

When I click on the element for the sidebar

How to use the Capistrano shell to execute commands on servers

Capistrano brings the shell command which allows you to run commands on your deployment targets.

You can run both Capistrano tasks and shell commands, and scope to individual machines or machine roles.


First of all, spawn a Capistrano shell (we're using the multistage extension here):

cap staging shell

In your "cap" shell you can now run Capistrano tasks by prepending an exclamation mark. For example:

cap> !deploy:revision
 ** [out ::] 9aeed9030db6a7b5b4ba077337545677b4fd5c22
 ** [out :: we...

Spreewald: Check that a CSS selector is present on the current page

Spreewald 1.3.0 comes with these steps:

Then I should see an element ".panel"
Then I should not see an element ".sidebar"
Then I should see an element ".twitter-timeline"

We recommend to define a selector_for method in features/support/selectors.rb so you can refer to the selector in plain English:

Then I should see an element for a panel
Then I should not see an element for the sidebar
Then I should see an element for the Twitter timeline

Using the Bash in VI mode

Activate VI mode by running

set -o vi

Now use your Bash as if it were VI! Hit Esc to enter command mode, jump around with e, w, b, 0, $ etc. and edit just as you're used to.

Bash history is searched with /. See the linked cheat sheet for more hints.

Git: Issues with Gemfile.lock

When there's a Gemfile.lock in your working directory that you cannot remove by either checkout, reset [--hard], stash, probably Rails' Spring is the culprit.


spring stop

The author of the linked Stackoverflow post supposes Spring re-writes the Gemfile.lock on change to ensure all Spring processes are using the same gem versions. Meh.

You can now override all Spreewald steps with more specific versions

You can now define this step without Cucumber raising Cucumber::Ambiguous:

Then /^I should see "whatever I want"$/ do

This is available in Spreewald 1.5.0+.

restart puppetmaster after changing custom functions

The puppet master caches custom functions. If you edit an existing function (e.g. while you’re developing it), you’ll need to restart the puppet master before the new version can be used.

That also means you can't test functions in a different puppet environment. And also if you have changed functions in a different puppet environment (where you e.g. test some new module version) and this environment runs at first after a puppetmaster restart, you have this changed functions also in your production environment.


Browsers will not send a referrer when linking from HTTPS to HTTP

  • When your site is on HTTPS and you are linking or redirecting to a HTTP site, the browser will not send a referrer.
  • This means the target site will see your traffic as "direct traffic", i.e. they cannot distinguish such hits from a user who directly typed in the URL.

Reasons for this behavior

It's probably because of this RFC:

Clients SHOULD NOT include a Referer header field in a (non-secure) HTTP request if the referring page was transferr…

Auto-destruct in 57 days

Updated: How to upgrade RubyMine

Added hint to update the mine command-line launcher.

External content

Instant Markdown previews from Vim

Live markdown previewer (with Github flavored syntax) for VIM.

Will open a preview in your browser and update automatically on each key press.

Override Cucumber steps without an ambiguity error

Cucumber raises a Cucumber::Ambiguous if more than one step definitions match a step.

Our new cucumber_priority gem provides a way to mark step definitions as overridable, meaning that they can always be overshadowed by a more specific version without raising an error.

This gem is currently used by spreewald and cucumber_factory.

Marking step definiti…

start tcpdump log on high traffic

Logging tcpdump output all the time can create a huge amount of data. This can be both: too much data size on HDD and tiring to analyze. You can run a script in a screen which checks out the packages transfered per second and start a tcpdump when the packages exceed a fixed number.

#!/usr/bin/env bash


while /bin/true; do
pkt_old=grep $interface: /proc/net/dev | cut -d : -f2 | awk '{ print $2 }'
sleep 1
pkt_new=`grep $interface: /proc/net/dev | cut -d : -f…


How to: Start Selenium browser maximized or with custom window size

If your application requires a minimum window size (like 1024 pixels wide) and/or you have tests failing because elements are out of reach and can't be clicked, you may want to set a specific size for your browser window.

Put the following code somewhere inside features/support (e.g. env.rb) to resize your browser window for any scenario tagged @javascript.

Before '@javascript' do
  page.driver.browser.manage.window.resize_to(1024, 768)

If this does not work, try using Capybara.current_session instead of page:


Defining and calling lambdas (ruby)

There are different ways to define a lambda in ruby:

  1. with lambda-keyword

    test = lambda do |arg|
      puts arg
  2. with the lambda literal -> (since ruby 1.9.1)

    test = -> (arg) do
      puts arg

And there are different ways to call a lambda:

  1. call'hello world')
  2. Square brackets

    test['hello world']
  3. .()

    test.('hello world')

Adjust cron jobs to allow full backtraces for rake tasks

As we get an exception notification, when a cron job fails, we wish to have the full backtrace in this mail. A rake task doesn't output the full backtrace by default, so you need the --backtrace option.


You will find fail mails with a shortened backtrace

Tasks: TOP => some_namespace:some_task
(See full trace by running task with --trace)

What rake wants from you
Running the rake task like rake some_namespace:some_task --backtrace

How this works with whenever
Define a own job_type and use it for r…


Stop writing "require 'spec_helper'" in every spec

Simply add this to your .rspec instead:

--require spec_helper
2977 cards