Search_spinner Cross_grey Magnifier
help

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"

Beware of curious behaviour of 'downcase' with umlauts

Using .downcase or .upcase on strings containing umlauts does not work as expected as it leaves the umlauts unchanged:

"Über".downcase
=> "Über"

"Ärger".downcase
=> "Ärger"

The very same applies for french accents (Thanks Guillaume!):

"Être ou ne pas être, telle est la question".downcase
=> "Être ou ne pas être, telle est la question"

Obviously, this leads to problems when comparing strings:
"Über".downcase == "über"
=> false

In Rails you can use ActiveSupports' [multibyte chars](http://apidock.c…

Fix: Cucumber won't start though cucumber.yml is correct

This is for you if you get this error:

cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.

Actually, it's likely that your cucumber.yml is just fine but not your rerun.txt.\
This sometimes happens when running multiple Cucumber workers with parallel_tests that write into rerun.txt simultaneously – ending up with a messy, invalid file.

Just remove it and you ar…

How to embed images in higher resolutions for printing

When you print out a HTML pages, all raster images (like PNGs) will appear aliased. This is because a printer's resolution is usually much higher than that of a computer screen.

If an image absolutely must look awesome when printed, a solution is to embed the image in much higher solution than needed (e.g. four times the horizontal resolution), then scale it down to the desired width using CSS.

Note that this will slightly alter the image's appearance on the screen because browsers will scale down the image [using an anti-aliasing method](…

Date or datetime picker for touch devices

jQuery UI's date picker and date time picker doesn't work on touch interfaces.

Solution 1: Use Mobiscroll

Another way is to detect touch devices and for those devices use the Date and DateTime picker from Mobiscroll instead:

if (isTouchDevice()) {
  $('.date_picker').scroller();
} else...

Always sort lists that are visible in the UI

This might seem obvious, but I'm rejecting stories because of this on a regular basis.

Whenever a list (e.g. an index of records or the options of a select box) is visible in the UI that list must be sorted. Unsorted lists are completely unusable once they contain more than 5 items.

How to fix the Apple Mail search problem in MacOS X 10.7 Lion

After my update from MacOS X 10.6 Snow Leopard to 10.7 Lion the search function in Apple Mail stopped working.
There were no or too little search results, when I typed something in the search field.
It looked like my mailboxes couldn't be indexed by spotlight anymore.

And here is the simple solution:

  1. Mark your mailbox in the list of mailboxes on the left in your apple mail window by clicking on its name once.
  2. From the menu select "Mailbox" => "Rebuild".
  3. After the rebuild you should get the right search results again.
  4. Proceed wi…

Make Makandra Consul work with RSpec 2.x and Rails 3.x

To make the RSpec matcher of the authorization solution Consul work with Rspec 2.x read the following blog post.

CSS box-shadow not working in IE9 inside tables with collapsing borders

Though Internet Explorer 9 supports the box-shadow CSS property there is a nasty bug which sometimes prevents it from rendering the shadow properly.

Consider this HTML:
<table style="border-collapse: collapse">
<tr>
<td>
<div style="box-shadow: 0 0 10px #f00">Hello universe</div>
</td>
</tr>
</table>

While it works in other browsers, IE9 is not showing any shadow. For some reason, it requires border-collapse: separate for the table to be set:

<table style="border-collapse: separate" ce...
External content

monperrus/ExpandAnimations - GitHub

ExpandAnimations is a LibreOffice/OpenOffice.org Impress extension to expand presentation animations before exporting to PDF. This way the exported PDF will have one page per animation stage.

Detect mobile or touch devices on both server and client

Although it's tempting flirt with detecting mobile/touch devices with CSS media queries or Javascript feature detection alone, this approach will be painful when heavily customizing a feature beyond just tweaking the looks. Eventually you will want want the same detection logic to be available on both server and client side.

This card shows how to get a Ruby method touch_device? for your Rails views and a method TouchDevice.isPresent() for your Javascripts.

Note that we are detecting touch devices by grepping the user agent, and the ke…

How to click hidden submit buttons with Selenium

In your Cucumber features you can't really click hidden elements when using Selenium (it does work for a plain Webrat scenario, though).

Unfortunately you need to hack around it, like this:

When /^I press the hidden "([^\"]+)" submit button$/ do |label|
  page.evaluate_script <<-JS
    $('input[type=submit][value="#{label}"]').show().click();
  JS
end

If your button is nested into a container that is hidden this will not do the trick. You need a more complex method to also show surrounding containers:

When /^I pre...

Right-align or center panel items in XFCE

  • Add a separator between left-aligned and right-aligned items.
  • In the separator properties, set the style to "Transparent" and check "Expand".
  • The separator will now grab all available space and hence push the right-hand items into the corner.

You can also use this trick to center panel items by using two separators (one on the left, one on the right side).

External content

Firefox 3.6 Support To end On April 24, 2012

Firefox 3.6 users will receive update notifications in April offered through the browser’s internal updating service that will update the version to the latest stable build of the browser.

External content

Pull Quotes with HTML5 and CSS

A pull quote is a typographical technique in which an excerpt or quote from an article is duplicated within the article using a different formatting style so that it jumps out at the reader.

Blatantly copying the excerpt of the pull quote into it’s own element is not the way to go. A pull quote is a purely visual technique, and therefore should not change the structure of the body. Next to that, a structural representation of the excerpt would be seen twice by people using feed readers or services like Instapaper, as well as be re-read for …

German localization for Mobiscroll

If you are using Mobiscroll for date pickers on touch devices, here is how to localize the Mobiscroll UI into German:

var germanMobiscrollLocalization = {
  preset: 'datetime',
  ampm: false,
  cancelText: 'Abbrechen',
  dateFormat: 'dd.mm.yy',
  dateOrder: 'ddmmyy',
  dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
  dayNamesShort: ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa'],
 ...

acts_as_taggable_on: Match records tagged with all, any or none of the given tags

The tagged_with scope comes with many awesome options to modify your search:

User.tagged_with("awesome", "cool")                     # Users that are tagged with awesome and cool
User.tagged_with("awesome", "cool", :exclude => true)   # Users that are not tagged with awesome or cool
User.tagged_with("awesome", "cool", :any => true)       # Users that are tagged with awesome or cool
User.t...
External content

Locale: Localisation for Rails developers

A possible way for localisation in Rails applications that allows editing translations remotely.

Get color in the Capistrano output

Note: capistrano_colors was merged into Capistrano starting from v2.13.5. However, this requires Ruby 1.9+.

If you cannot upgrade Capistrano to 2.13.5+ (e.g. because you're still running on Ruby 1.8), simply put capistrano_colors into your Gemfile and require 'capistrano_colors' in your config/deploy.rb file.

2878 cards