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"

Install the gherkin gem with native extensions

When trying to install the gherkin gem, you might well encounter an error saying:

cc1: warnings being treated as errors

If upgrading is not an option (corresponding issue on github), you can install it properly by changing the compiler flags as follows:

gem install gherkin -v '2.2.9' -- --with-cflags=-w

If you cannot install the specific version you intent to, try uninstalling the gem first.

To install the gem with bundler you can to do this:

bundle config build.gherkin...

Git: Remove information on branches that were deleted on origin

When branches get deleted on origin, your local repository won't take notice of that.

You'll still have your locally cached versions of those branches (which is actually good) but git branch -a will still list them as remote branches.

You can clean up that information locally like this:

git remote prune origin

Your local copies of deleted branches are not removed by this.

The same effect is achieved by using (kudos to Julien):

git fetch --prune

You could also set that as a default.

External content

TodoMVC - A common learning application for popular JavaScript MV* frameworks

Developers these days are spoiled with choice when it comes to selecting an MV* framework for structuring and organizing JavaScript web apps. Backbone, Spine, Ember (SproutCore 2.0), JavaScriptMVC… the list of new and stable solutions goes on and on, but just how do you decide on which to use in a sea of so many options?

To help solve this problem, we created TodoMVC - a project which offers the same Todo application implemented using MV* concepts in most of the popular JavaScript MV* frameworks of today.

Solutions look and feel the same…

RubyMine: Exclude data and log directories from a project

RubyMine offers you to exclude directories from search, meaning faster search results and less "noise" in the list of result.

Right-click a folder in your project tree and click "Mark Directory As" → "Excluded".

Do it for your your log, data, and other directories that you don't need to access during development and whose search results are irrelevant.
They won't be deleted but simply ignored when searching across a project's files.

TeamViewer 7 finally works with multiple screens under Linux

TeamViewer 6 and lower had an issue where they would see a multi-monitor Linux setup as a single wall of pixels. This is fixed in version 7. The guest can now select the currently active screen from the TeamViewer menu.

Issues with has_select?

The handy method has_select?(field, :selected => text) does not behave as expected with Cucumber 0.10.2, Capybara 0.4.1.2 and Selenium 0.2.2. It may not recognize a select field if the selected option with the text has no value. If you don't have the possibility to upgrade these Gems, probably the best way to go is to distinguish the current Capybara driver:

```
Then /^"([^"])" should be selected for "([^"])"(?: within "([^"]*)")?$/ do |value, field, selector|
with_scope(selector) do

# currently needed due to different behav...

Debugging Google Analytics

If you need to debug Analytics tracking, consider using this chrome extension. It will replace the tracking code with a debug version that prints debugging info to the JavaScript console.

Markdown/Kramdown examples

This card shows you how to format a card's content using Markdown. We use the Kramdown interpreter, so here are examples for its dialect.

Formatting

**Bold**

Bold

_Italics_

Italics

`Monospaced`

Monospaced

> Quoted text

Quoted text

Here is [a link](http://makandra.com/).

Here is a link.

```text
![An image; this is the alt text](http://www.makandra.co…

Creating the inverse of a Rails migration

Let's say you need to revert a migration that happened a while back. You'd create a new migration that removes what was added back then in the up path, while its down path restores the old functionality.

While you could just copy&paste the down and up parts of it to the inverse part of the new migration, you may not want to do that. Especially when the up/down paths already contained some logic (that executed update statements on the created column, for example), copying does not feel right.

Someone already added the logic how to…

Git: Diff changes in a long line efficiently

Instead of showing you two lines for each change, Git allows you to highlight changes in a line explicitly:

git diff --word-diff some_file

Hello [-world-]{+universe+}!

(The result is usually colored nicely, the removed part being red and the added text green.)

When doing a diff on a long line, this can be very helpful but you'll still get a less-like scrolling output that can be unhandy to use.\
You maybe just want the diff put into your terminal:

PAGER='' git diff --word-diff some_file

will_paginate on complex scopes may be slow (workaround)

will_paginate triggers a database query to determine the total number of entries (i.e. to let you display the number of search results). When you paginate complex scope (e.g. that has many includes), this query may take several seconds to complete.

If you encounter this behavior, a solution is to calculate the total count yourself and pass it to the pagination call:

scope = User.complex_scope_full_of_includes
total_number_of_users = scope.count
@users = scope.paginate(:total_entr...
External content

Convert Virtualbox .ova Image to .ovf

The .ova file format is a tar file with a .ovf file inside.
tar xvf virtualboximage.ova

Compare two XML strings as hashes

Let's say you have two XML strings that are ordered differently but you don't care about the order of attributes inside containers:

a = '<?xml version="1.0" encoding="UTF-8"?><Authenticate><User>batman</User><Password>secret</Password></Authenticate>'
b = '<?xml version="1.0" encoding="UTF-8"?><Authenticate><Password>secret</Password><User>batman</User></Authenticate>'

Working with plain string comparison is not helpful, of course:

a == b
=> false

Instead, you can use the Nori gem …

ActiveRecord: Overwriting a setter causes trouble with attributes depending on each other

Undeterministically I got a nil error on saving the object caused by the random order of hash elements of the params hash.

class Feedback
  belongs_to :user

  def role=(value)
    @role = value
    self.email = find_email_by_name(user.name)
  end
end

This piece of code works well until the object params hash contains a second element when it is updated like this:

@feedback.update_attributes!(params[:feedback])

Now it is no longer ensured that user was set before name was set. If the name…

RubyMine: Find and execute a menu action by its name

You are looking for a functionality in RubyMine but don't know or remember its keyboard shortcut or which menu it is located in?\
Hit Ctrl+Shift+A.

This will bring up the "Find Action" box where you can enter an action's name or category. Pick the result from the list to run it.

The list of results will also show you any assigned keyboard shortcuts.

rubymine-find-action.png

WebMock 1.8.0 does not play nice with Curb < 0.7.16

When updating WebMock, be prepared that your specs may send real requests into the depths of the internet unless you update Curb as well.\
WebMock will not complain about those requests not being stubbed.

One of the commits that made it into 1.8.0 actually breaks Curb versions below 0.7.16 while fixing it for that version (and above, hopefully).\
WebMock's hooks for Curl::Easy are sti…

Sunspot and Solr on Tomcat: Trouble with Umlauts

We experienced problems with Sunspot and Solr on Tomcat: Umlauts (ä, ö, ü) were not correctly handled on Tomcat while everything was okay on the local development machines (your local Sunspot service you start with the sunspot:solr:run task is based on Jetty).

We use a stemmer that reduces "Sänger" to "sang" and "Sanger" to "sang" as well.
Though, results for "Sänger" where empty on Tomcat.

This is due to a UTF-8 bug in RSolr (see Github for some discussion on that).
The bug is fixed in a …

Nicer alternatives to def_delegator or def_delegators

Delegating methods to other objects is often helpful but the syntax of both def_delegators and def_delegator is a complete mess that makes your code hard to read.

Consider these classes:

class Topic < ActiveRecord::Base
  def title
    "A title"
  end
  
  def category
    "Topic category"
  end
end

class Post < ActiveRecord::Base
  belongs_to :topic
  def_delegato...
2882 cards