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

PhoneGap Build

Write your app using HTML, CSS or JavaScript, upload it to the PhoneGap Build service and get back app-store ready apps for Apple iOS, Google Android, Windows Phone 7, Palm, Symbian, BlackBerry and more.

By compiling in the cloud with PhoneGap Build, you get all the benefits of cross-platform development but can still build apps just the way you like.

How to enable MySQL query logging

This will make MySQL log all received queries so you can see for yourself what happens on the database level.

Don't switch this on for production machines!

  1. Edit your my.cnf:
    sudo vim /etc/mysql/my.cnf
  2. In the [mysqld] section, add:
    log=/var/log/mysql.log
  3. Restart your MySQL daemon. On Ubuntu:
    sudo service mysql restart

Note that your MySQL performance will suffer. But when you need to enable query logging for a debug fest, you probably don't care about that.

Update Skype 4.x to at least 4.0.0.8

There was a bug in Skype that could cause messages to be sent to incorrect recipients (anyone, not only people from your contact list).

If you were using Skype 4 on Linux (or Skype on any other platform), upgrade immediately.

I don't know if Skype 2 on Linux is affected.

Click on a piece of text in Cucumber / Capyabra

The step definition below lets you write:

When I click on "Foo"

This is useful in Selenium features where the element you click on is not necessarily a link or button, but could be any HTML element with a Javascript event binding.

The easiest way to get this step is to use Spreewald. If you would like to add it manually, here is the step definition:

When /^I click on "([^\"]+)"$/ do |text|
  matcher = ['*', { :text => text }]
  element = page.find(:css, *matcher)
  while be...

New cards feature: Explicit language declaration for syntax highlighting

Makandra cards will auto-detect the language used for syntax highlighting.

This auto-detection sometimes fails for short code snippets. In such cases you can explicitly declare the language for Github-style code blocks:

```css
body {
  font-size: 12px
}
```

Will turn into this:

body {
  font-size: 12px
}

To disable syntax highlighting entirely use the text language:

```text
I am nothing without pretend ...

How to: Limit or disable textarea resizing in Chrome and Firefox

Consider this Sass:

.comment
  width: 320px;
  height: 240px;

Any textarea with the comment class will be sized 320 by 240 pixels. In WebKit browsers (Chrome, Safari, …) or Firefox, this is only the initial size – users can resize textareas to become bigger.

This is helpful to the user, but may be breaking your application layout in some cases.

If you want to disable it, don't introduce any proprietary CSS properties. Instead, set maximum width and/or height to the values of width and height:

.comment
  wi...

Drag'n'drop in trees: I went to town

For my Gem Session project Holly I ran the Ironman of drag'n'drop implementations:

  • Dragging in nested lists
  • User-definable order of items
  • Complicated item elements with super-custom CSS and other Javascript functionality
  • Items that can be both leaves and containers of other items
  • has_ancestry on the server side

Things I learned:

  • Be ready to write a lot of CSS. You need to indicate what is being dragged, where it will be dropped, if it is dropped above, below o…
External content

jQuery.cssHooks – jQuery API

The $.cssHooks object provides a way to define functions for getting and setting particular CSS values. It can also be used to create new cssHooks for normalizing CSS3 features such as box shadows and gradients.

For example, some versions of Webkit-based browsers require -webkit-border-radius to set the border-radius on an element, while earlier Firefox versions require -moz-border-radius. A css hook can normalize these vendor-prefixed properties to let .css() accept a single, standard property name (border-radius, or with DOM property synt…

Updated: Check whether an element is visible or hidden with Javascript

  • Added information about what jQuery considers "visible"
  • Added a solution for Prototype
  • Added a patch for Prototype that replaces the useless Element#visible() method with an implementation that behaves like jQuery.

Speed up large Cucumber test suites

Note: The information is this card is ancient and probably no longer accurate.


Test suites usually grow over time as more and more development time is spent on a projects. Overall run-time and performance of Cucumber suites in turn increases, too.

You can use the very same way Henning suggested for speeding up RSpec some time ago.

Put the following into features/support/deferred_garbage_collection.rb

Before do
  DeferredGa...

Bundler: Fatal error and 'no such file to load -- net/https'

Today, I ran into trouble on a fairly fresh installed VM, running Ubuntu. I tried to bundle install and got this stacktrace:

```text
Fetching gem metadata from https://rubygems.org/.Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require': no such file to load -- net/https (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in require'
from /usr/li…

Nice way to call multiple steps from a step definition

Use %-notation:

Given /^I have an article in my cart$/ do
  steps %{
    And I go the article list
    And I open the first article
    And I press "Add to cart"
  }
end

Nice way to set data attributes when creating elements with Rails helpers

You can say this in helpers like link_to and content_tag:

= link_to 'Label', root_url, :data => { :foo => 'bar', :bam => 'baz' }

This will produce:

<a href="/" data-foo="bar" data-bam="baz">Label</a>

Only works in Rails 3. In Rails 2 you do

= link_to 'Label', root_url, 'data-foo' => 'bar', 'data-bam' => 'baz' }

Updated: Capybara: Check that a page element is hidden via CSS

  • The step we used in the past (Then "foo" should not be visibile) doesn't reliably work in Selenium features.
  • I overhauled the entire step so it uses Javascript to detect visibility in Selenium.
  • The step has support for jQuery and Prototype projects, so it should be a drop-in replacement for all your projects.
  • For Rack::Test the step no longer uses XPath so you should be able to understand it when you are not a cyborg :)
  • There were some other cards detailing alternative steps to detect visibility. I deleted all these other cards s…

RubyMine: Using pinned tabs will increase your productivity

I highly recommend that you make use of RubyMine's feature to pin tabs.

When you pin all "important" files, you can follow method definitions, wildly open files from search results and have a ton of open tabs – without the problem of finding the stuff you were working on before.

Guide

  1. Pin the tabs of files that are currently in the focus of your work (important models, specs, etc):
    • Right-click a tab and select "Pin tab"
    • Or use a shortcut (see below)
  2. Work as usual.
  3. Once you opened other tabs because you searched …

New cards feature: Personal RSS feed that includes public and private cards

Your account profile now links to a personal RSS feed. This RSS feed contains the newest public and private cards for all your decks.

When overwriting "method_missing", remember to overwrite "respond_to?" as well

When you use method_missing to have an object return something on a method call, always make sure you also redefine respond_to?.

If you don't do it, nothing will break at a first glance, but you will run into trouble eventually.

Consider this class:

class Dog
  
  def method_missing(method_name, *args, &block)
    if method_name == :bark
      'woof!'
    else
      super
    end
  end
  
end

This will allow you to say:

Dog.new.bark
=> "woof!"

But:

Dog.new.respond_to? :ba...

Install rabbitmq plugins (e.g. management plugin) on Ubuntu 12.04

If you want to install rabbitmq plugins on Ubuntu 12.04 you can do this with:

/usr/lib/rabbitmq/lib/rabbitmq_server-2.7.1/sbin/rabbitmq-plugins

This binary is not in your default $PATH. Beause of this you have to give the full path.

3085 cards