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"

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…
External content

Skype For Linux With Tabs Support Using SkypeTab NG

SkypeTab-NG (NG stands for Next Generation) is a tool that adds tabs to Skype for Linux. Besides providing a tabbed chat window, the SkypeTab-NG also embeds both the conversation and the main Skype windows in a single window.

Error "The --deployment flag requires a Gemfile.lock. Please make sure you have checked your Gemfile.lock into version control before deploying."

If you get this error while deploy and you are sure the Gemfile.lock is in the version control check your releases directory.

This error can occur if someone/something copy a file or directory into your releases directory.

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

tanoku/redcarpet - GitHub

Ruby bindings for Sundown, a fast and full-featured Markdown parser that lets you define renders for arbitrary output formats.

Update: Aggregated RSpec/Cucumber test coverage with RCov

Our rcov:all task for aggregated RSpec/Cucumber coverage was overhauled extensively. Among other things it now works for Rails 2 and 3 and has an option to ignore shared traits.

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.

Limiting CPU and memory resources of Paperclip convert jobs

If you’re using Paperclip to store and convert images attached to your models, processing a lot of images will probably cause headache for your system operation colleagues because CPU and/or memory peaking.

If you’re on Unix you can use nice to tell the Kernel scheduler to prefer other processes that request CPU cycles. Keep in mind that this will not help if you’re running into memory or IO trouble because you saved some bucks when you ordered (slow) harddrives.

ImageMagick (the tool which is used by Paperclip to do all that funky ima…

RCov: The difference between "code coverage" and "total coverage"

Code coverage is the ratio of code lines kissed by a test vs. the total number of lines in your source files. This sounds meaningful, but isn’t.

Total coverage additionally ignores whitespace and comments when computing the coverage ratio, which is what you want.

2854 cards