One of the many useful features of TextMate is autocompletion of words. If I were in TextMate right now, I...

stackoverflow.com

Have you ever opened a file with vim, edited it and when you wanted to save your changes it told...

Rails migrations allow you to use a change method whose calls are automatically inverted for the down path. However, if...

For our production servers we use Passenger as a Ruby application server. While it is possible to use Passenger for...

docs.angularjs.org

In addition to the {{ myValue }} two-way binding syntax, since Angular 1.3 there's a one-time binding syntax, prefixing...

Creating records in specs can be so fast that two records created instantly after one another might have the same...

Returning an empty scope can come in handy, e.g. as a default object. In Rails 4 you can achieve this...

class Document < ActiveRecord::Base scope :any_tags, -> (tags){ where('tags && ARRAY[?]', tags) } scope :all_tags, -> (tags){ where('tags @> ARRAY...

api.rubyonrails.org

To avoid n+1 queries, you want to eager-load associated records if you know you need to access them...

In Rails, you can very easily send emails with HTML and plaintext bodies. However, if you're trying to debug...

Use reorder to replace an existing order clause with a new expression.

If you get an error like this: An error occurred while installing pg (0.17.1), and Bundler cannot continue.

Sometimes you need complex expectations on method arguments like this SomeApi.should_receive(:find).with(:query => '*foo*', :sort => 'timestamp ASC', :limit...

makandra dev
github.com

PDFKit converts a web page to a PDF document. It uses a Webkit engine under the hood...

ozmm.org

require 'net/http' module Cheat extend self # the magic ingredient def host @host ||= 'http://cheat.errtheblog.com/' end def http @http ||= Net...

makandra dev
github.com

edge_rider is Power tools for ActiveRecord relations (scopes). Please note that some of the functions edge_rider provides have...

dev.mysql.com

Directly from the MySql docs: There are three likely causes for this error message. Usually it indicates network connectivity trouble...

makandra dev
linux.die.net

When connecting to multiple (i.e. > 4) servers to dive into logfiles or do security updates, terminator is what you want...

As you know, assignable_values does not invalidate a record even when an attribute value becomes unassignable. See this example...

When you have a string containing umlauts which don't behave as expected (are not matched with a regexp, can...

github.com

jQuery plugin that makes it easy to dynamically add and remove records when using ActiveRecord's nested attributes.

ActiveRecord caches results of SQL queries. If you want to discard the cached results for one model, you can call...

Edge Rider gives your relations a method #origin_class that returns the class the relation is based on.

robots.thoughtbot.com

Declare an enum attribute where the values map to integers in the database, but can be queried by name.