makandra dev

The information in this card is only relevant for Rails 2.3-era apps. This note gives a quick introduction into...

Note that you cannot currently use Ruby 1.9.2 with Rails 2 applications that use RSpec, so don't upgrade if...

ActiveRecord comes with a method touch which sets the updated_at timestamp to the current time. Unfortunately it also runs...

Add deprecation warnings and their solution or link to available solutions. Global access to Rake DSL methods is deprecated. Please...

Pie sometimes does not properly redraw elements upon changes. This often happens when the change comes from somewhere further up...

The attached RSpec matcher exist_in_database checks if a given record still exists in the database and has not...

Install OpenSSH Server: sudo apt-get install openssh-server To check if the server is running you should get no...

makandra dev
pixelbeat.org

An overview of common vim commands, including: windows buffers undo/redo navigation bookmarks selection/whitespace clipboard shortcuts search/replace programming external filters

You can find ActiveRecord models by using a Range as its conditions: User.scoped(:conditions => { :id => 3..5 }) This will generate...

When you set both a record's association and that association's foreign key attribute, Rails does not realize you...

Pressing the ? key will display a list of keyboard shortcuts. Available shortcuts are: search / help ? add story a toggle backlog...

MySQL's MIN and MAX functions are for aggregations only. This will not work and produce an error:

makandra dev

If you use a form (or form fields) multiple times inside one view, Rails will generate the same id attributes...

en.wikipedia.org

Although you can access many symbols using the AltGr key you may be missing some, like the en-dash (–) or...

makandra dev

There is no good equivalent for the Unix sudo command in Windows. Below are a few workarounds that are all...

To open a terminal quickly navigate to System → Preferences → Keyboard Shortcuts. There, click the "Run a terminal" row (It should...

Have a backup. Stop MySQL: sudo service mysql stop Move (or copy) your mysql directory. If you want /mnt/mysql to...

makandra dev

Using OpenSSL it's very easy to seriously encrypt files. Use the script below. Input / Output are self explanatory. Put...

If you run specs or your application and get an error like: ActionController::MissingFile in 'ProductsController#show, should render PDF...

When you use the send_file method to send a local file to the browser, you can save resources on...

A check if two date or time ranges A and B overlap needs to cover a lot of cases:

There are times when you need to send SQL to the database, like this: def self.some_count(field) field = connection.quote...

From time to time we're convinced that an error must be very close to the network card, OS IP...

It's that simple to allow one of your Linux users to run a single command as UID 0: