Plugins (and gems) are typically tested using a complete sample rails application that lives in the spec folder of the...
This collection of Sass mixins enables cross-browser styling (including IE with CSS3PIE) with less lines of code.
This is non-trivial because you need to fake event objects and require different code for different browsers. Luckily, there...
For clarity and traceability, your commit messages should include the ID and title of the Pivotal Tracker story you're...
Regular spaces and non-breaking spaces are hard to distinguish for a human. Instead of using the HTML entity...
Given this class: class Foo class Bar end end If you want to clean up this code with the modularity...
If a controller action responds to other formats than HTML (XML, PDF, Excel, JSON, ...), you can reach that code in...
The ancestry gem allows you to easily use tree structures in your Rails application. There is one somewhat unobvious pitfall...
Note: We are talking about Machinist 1 here, Machinist 2 may have solved this or might require a different approach...
If you want to see how long your database queries actually take, you need to disable MySQL's query cache...
This post will describe how I stumbled upon a code path in the Linux kernel which allows external programs to...
[ ] [ ]= ** ! ~ + - * / % + - >> << & ^ | <= < > >= <=> == === != =~ !~ && || .. ... ? : = %= { /= -= += |= &= >>= <<= *= &&= ||= **= defined? not or and if unless while until begin/end For more information see Table 18.4 in The Pragmatic Programmer's...
Note that you should disable the Java plug-in in your browsers after installation. Ubuntu >= 12.04 Java 11
We use RTeX for PDF exports. While converting LaTeX to PDF, RTeX opens a temporary file which has problematic permissions...
When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...
In a great post about named routes in Rails, path vs. url, Viget Labs ponders which variant is best used...
WMD is a simple, lightweight HTML editor for blog comments, forum posts, and basic content management. You can add WMD...
Expiration of Rails sessions By default Rails sessions expire when the user closes her browser window. To change this edit...
When submitting textareas, browsers sometimes include carriage returns (\r) instead of just line feeds (\n) at the end of each...
There are two distinct ways of commenting Haml markup: HTML and Ruby. HTML comments This will create an HTML comment...
This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...
Rails 3, 4, 5, 6 config/application.rb config/environment.rb before the initialize! call (we don't usually edit this file)
There are three ways to define your own RSpec matchers, with increasing complexibility and options: 1) Use RSpec::Matchers.define
When working with times and dates in Rails applications, you need to deal with the following problem: In Rails, Time...