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"
Auto-destruct in 60 days

Updated: Eager loading polymorphic associations

Added notice about joined associations which do not eager load with rails out of the box.

External content

Problems and Troubleshooting · mperham/sidekiq Wiki

When using Sidekiq in your application, you must write thread-safe code.

This wiki page also lists gems that are known to be unsafe on threaded applications.
When adding a gem that will also be used by a Sidekiq worker, make sure to confirm it's thread-safe.

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 53 days

Updated: How to upgrade RubyMine

Added hint to update the mine command-line launcher.

Beware ruby's var1 = var2 = "value" multiple assignment

This looks like it is safe to use:

2.2.1 :001 > a = b = "hello world"
"hello world"
2.2.1 :002 > a
"hello world"
2.2.1 :003 > b
"hello world"
2.2.1 :004 > b = " goodbye!"
" goodbye!"
2.2.1 :005 > a
"hello world"
2.2.1 :006 > b
" goodbye!"

But it isn't!

2.2.1 :010 > a = b = "hello world"
"hello world"
2.2.1 :011 > a
"hello world"
2.2.1 :012 > b
"hello world"
2.2.1 :013 > b << " goodbye!"
"hello world goodbye!"
2.2.1 :014 > a
"hello world goodbye!"
2.2.1 :015 > b
"hello world goodbye!"

What is happening when we do `a = b = …

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 (we prefer this)'hello world')
  2. Square brackets (could easily mistaken for a hash)

    test['hello world']
  3. .() (weird, isn't it?)

    test.('hello world')

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.
There is also invoke to run a command directly from your terminal.

Both commands allow running Capistrano tasks or shell commands, and scope to individual machines or machine roles.

cap shell


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

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.

2981 cards