Creating the inverse of a Rails migration

Posted About 12 years ago by Arne Hartherz.

Let's say you need to revert a migration that happened a while back. You'd create a new migration...

Gatekeeping: Guide for developer

Posted Almost 12 years ago by Tobias Kraze.

Note: This process is tailored to our specific needs and tools at makandra. While it will certainly not apply to...

Gatekeeping: Guide for gatekeeper

Posted Almost 12 years ago by Tobias Kraze.

Note: This process is tailored to our specific needs and tools at makandra. While it will certainly not apply to...

RestClient sends XML Accept header by default

Posted About 12 years ago by Thomas Eisenbarth.

REST Client is a nice, simple HTTP client library for Ruby. When you do a simple GET request like that...

Auto-generate Cucumber navigation paths

Posted About 12 years ago by Henning Koch.

Don't you just hate to write Cucumber path helpers to be able to say this?

Use the "retry" keyword to process a piece of Ruby code again.

Posted About 12 years ago by Ulrich Berkmueller.

Imagine you have a piece of code that tries to send a request to a remote server. Now the server...

Sunspot for Solr fails with '400 Bad Request' in 'adapt_response'

Posted About 12 years ago by Thomas Eisenbarth.

If Sunspot does not work and fails with a backtrace similar to this: /project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:227:in `adapt_response' /project/shared/bundle/ruby/1.8/gems/rsolr-1.0.6/lib/rsolr/client.rb:164...

Why your javascripts should be executed after the dom has been loaded

Posted About 12 years ago by Ulrich Berkmueller.

Most of the JavaScript snippets have code that manipulates the DOM. For that reason dom manipulating javascript code should have...

Detect mobile or touch devices on both server and client

Posted Over 12 years ago by Henning Koch.

Although it's tempting flirt with detecting mobile/touch devices with CSS media queries or Javascript feature detection alone, this approach...

Limiting CPU and memory resources of Paperclip convert jobs

Posted Over 12 years ago by Thomas Eisenbarth.

If you're using Paperclip to store and convert images attached to your models, processing a lot of images will...

How to deal with MethodNotAllowed errors

Posted Over 12 years ago by Tobias Kraze.

One of the most common production errors are ActionController::MethodNotAllowed errors. They usually happen when someone reloads a form by...

Useful script to collect downloads from several sites

Posted Over 12 years ago by Dominik Schöler.

For university I have to stay up-to-date with lecture documents. Since my university doesn't offer RSS feeds...

Request a gzipped response from a web server using Wget

Posted Over 12 years ago by Arne Hartherz.

To reduce download time, application servers usually serve content using gzip compression, if the browser supports it.

Caching may break relative paths in your merged stylesheet

Posted Over 12 years ago.

If you turn on stylesheet caching, it might happen that stylesheets from different locations with different relative pathes will be...

How to ignore new files or changed files in git

Posted Over 12 years ago by Ulrich Berkmueller.

How to ignore new files Globally Add the path(s) to your file(s) which you would like to ignore...

Declare different CSS background-images for different locales

Posted Over 12 years ago.

If you would like to use language specific layout (e.g. background-images) in your applications stylesheets you can achieve this...

Web font embedding requires new CSS for IE9

Posted Over 12 years ago by Henning Koch.

If you embedded web fonts in the past years (e.g. by copying CSS from a Font Squirrel @font-face kit...

How the Clearance gem remembers and clears sessions

Posted Over 12 years ago by Ulrich Berkmueller.

Clearance is a gem that provides authentication functionality (e.g. login, logout). This note explains, how the clearance login, logout and...

Improve web font rendering in Windows by autohinting fonts

Posted Over 12 years ago by Henning Koch.

Web fonts are awesome. After being restricted to Arial for two decades there is finally a cross-browser way to...

Git: How to create and apply patches

Posted Over 12 years ago by Arne Hartherz.
linux.die.net

You can convert git commits into patch files. Those can be used to apply to a different repository [1] or...

Stub a request's IP address in a Cucumber scenario

Posted Over 12 years ago by Henning Koch.
stackoverflow.com

The solution in this card is based on a stack overflow post by Leventix. If you need to make request...

Parse & sort unique hits in logfiles

Posted Over 12 years ago by Thomas Eisenbarth.

If you want to know the exact hits on your website (or whatever logfile you want) for a specific date...

Rails logs are not flushed automatically (in Rake tasks)

Posted Over 12 years ago by Arne Hartherz.

The Rails logger will store its content in a buffer and write it into the file system every 1000 lines...

Monitor a Rake task with God

Posted Over 12 years ago by Henning Koch.

In order to monitor a Rake task using God your Rake file must write a file with its process ID...