This trick might be useful to implement more complicated directives in AngularJS. I needed it to do drag'n'drop...
When HTTP clients make an request they can define which response formats they can process. They do it by adding...
Authentication is hard: there are many edge cases, and most users (including yourself) usually only go the "happy path" once...
We have often felt the pain where our models need to serve too many masters. E.g. we are adding a...
In the following example the method update_offices_people_count won't be called when office_id changes, because it...
When you want to do a git diff but do not care about the full diff and just want to...
Create a directory mkdir ~/.aws Initialise git repository cd ~/.aws && git init Create a git branch with a name you...
You can detect city and country from an IP address by using the GeoLite database. This is a flat file...
You probably haven't configured version control for your project. Go to Project Settings / Version Control and set the director...
We ran into trouble when adding additional compute units to our railscomplete Hosting environment lately. VM-instances on the new...
Awesome battle report from Pinterest trying to scale their setup using different approaches. When you push something to the limit...
tl;dr: Ruby's Bundler environment is passed on to system calls, which may not be what you may want...
When using the json gem, you might run into this error when using JSON.parse: >> json = 'foo'.to_json >> JSON.parse(json...
jQuery plugin to fire events when user's cursor aims at particular dropdown menu items. For making responsive mega dropdowns...
Rails gives you migrations to change your database schema with simple commands like add_column or update. Unfortunately these commands...
Caution when using .where to exclude records from a scope like this: # Fragile - avoid User.where("id NOT IN (?)", excluded_ids...
This only works when you actually have a session ID (not the case for Rails' CookieStore, for example): request.session_options...
In specs, the session never persists but is always a new object for each request. Data put into the session...
All Rubyists should be familiar with the common definitions for include and extend. You include a module to add instance...
Non-SSL contents on SSL pages are blocked by default Bug 834836 – Turn on pref to block mixed active content...
All columns of a model's database table are automagically available through accessors on the Active Record object.
Note: This technique is confusing and slows down your test suite. Copy the attached code to features/support. This gets you...
Say you want to allow users to emphasize some string, but the whole markdown thing would be far too much...
Usually, the logrotate service takes care of renaming log files each night or so to avoid logs becoming huge. That...