I was recently confronted with the task of creating a two-column liquid layout with a header and footer in...
The ‘merge.*.driver` variable’s value is used to construct a command to run to merge ancestor’s version, current...
In order to redirect all requests from redirecting-host.com to desired-host.com while keeping path and query params unchanged, change your Apache...
In regular expressions you can use the zero-width pattern \b to match the beginning or end of a word...
You configured authentication in your Apache configuration that requires username and password but you want a single IP address, host...
In RSpec 2 shared_examples_for can have parameters. You can simply hand over arguments from it_behaves...
When you need to see the content of a page (i.e. not all the HTML but the relevant text body...
Learning Rails for the first time should be fun, and Rails for Zombies allows you to get your feet wet...
If you need to export data from MySQL to a CSV, you can profit from really fast built-in methods...
Styling button tags across all major browsers is not easy. Many times you should be fine by using the native...
To clear the query cache in your MySQL database manually, e.g. for database profiling, execute the following command in your...
Every time you amend, rebase or reset, git commits get "overwritten". However, git still allows you to checkout those commits...
So you added a new callback to your model that (e.g.) caches some data when it is saved. Now you...
You can usually just use the eq matched to compare two numbers: expect(deal.total).to eq(120)
How to create an infinitely nestable hash that always defaults to a new hash if a key does not map...
Ruby's net/http is setup to never verify SSL certificates by default. Most ruby libraries do the same. That means...
How to write to the db 27,000 times in 24 seconds instead of 9 minutes.
You can use these step definitions: Then /^I should not see an error$/ do (200 .. 399).should include(page.status_code...
When you eagerly load an association list using the .include option, and at the same time have a .where on...
Sometimes, you just need to shoot from the hip…or deploy your local changes without committing them. Put this snippet...
If you want to find out whether a Class object is directly inheriting from another class, use superclass: ActiveRecord::RecordNotFound.super...
RSpec 1, RSpec 2 To test whether two arrays have the same elements regardless of order, RSpec 1 and 2...
Use the htmlentities gem. Encoding works like this: require 'htmlentities' coder = HTMLEntities.new string = "<élan>" coder.encode(string) # => "<élan>"
These two models can be used to access the posts and associated comments of a WordPress database.