When you are using the #selector_for helper in Cucumber steps, as e.g. Spreewald does, the following snippet will save...
Enumerable#count can do three things. With no argument provided, it returns the number of items. With an argument, it...
Array#flatten by default flattens an array recursively. To only flatten the array for e.g. one level, it takes an...
When running migrations with rake db:migrate, there's the STEP and VERSION parameters that you can pass to nearly...
The Javascript in operator does what Hash#has_key? does in Ruby: Return whether an object has a property.
This will list all branches matching your query as input options for git checkout greckout ar 1) ar/cache-api-keys-1098...
Add gem 'database_cleaner' to your Gemfile. Then: Cucumber & Rails 3+ # features/support/database_cleaner.rb DatabaseCleaner.clean_with(:deletion) # clean once, now DatabaseCleaner.strategy = :transaction...
In the tradition of our PostgreSQL cheat sheet for MySQL lamers, here is a cheat sheet for Jasmine when you...
You can do so much more than console.log(...)! See the attached link for a great breakdown of what the developer...
This step will pass if the specified select is sorted. Then /^the "(.*?)" select should be sorted$/ do |label, negate|
Chances are you're seeing the warning repeated a lot of times, maybe thousands of times. Here's how to...
If you want a class-like construct in JavaScript, you can use the module pattern below. The module pattern gives...
When using git diff, you might encounter weird characters where umlauts (or any other UTF-8) characters should be. It...
Option 0: Download from the official page (preferred) Open https://googlechromelabs.github.io/chrome-for-testing/ In Section "Stable" > chromedriver / linux64 > Download ZIP from...
One of the many useful features of TextMate is autocompletion of words. If I were in TextMate right now, I...
A great two-part article about various hacks you can use to create great-looking screen designers when you're...
Rails migrations allow you to use a change method whose calls are automatically inverted for the down path. However, if...
Upgrading from Ruby 1.8.7 to 2.1.2 took me an hour for a medium-sized application. It involved hardly any changes...
Firefox 5.0.1, which we were using for most Rails 2.3 projects, does not run on Ubuntu 14.04 any more. Here...
In a JavaScript console, type this: > 9112347935156469760 9112347935156470000 Ooops. And that's not a float! This occurs because JavaScript uses...
JavaScript's NaN ("Not a Number") is hard to compare against. It never equals anything, not even itself:
Since we are using LoDash instead of UnderscoreJS in recent/current projects, you should keep in mind that their syntax is...
We upgraded a Rails 2 application to Rails 3.2 and Ruby 2.1, changed the mysql adapter from mysql to mysql2...
To avoid n+1 queries, you want to eager-load associated records if you know you need to access them...