Consider this class: class Foo private def test puts "Hello" end end While you can say create a block to...
...Mar 2013 11:56:03 CET +01:00 >> Time.current.to_s(:db) => "2013-03-15 10:56:03" # This is now UTC Problem That will blow up in your face when...
...Sat, 01 Jan 2050 00:15:00 CET +01:00 >> Time.current.to_s(:db) => "2049-12-31 23:15:00" # This is the correct representation of our time.
Ruby 1.8 (supplied by Rails' ActiveSupport) >> BigDecimal.new("0.1").floor.class => BigDecimal Ruby 1.9 (supplied by Ruby 1.9 itself) >> BigDecimal.new("0.1").floor.class...
Guide how to make fixes in other people's GitHub repositories. It's basically "Open Source Development 101".
Google Chrome saves your profile data in ~/.config/google-chrome. To transfer the profile to for example a system you have setup...
When you use heredoc, string interpolation is enabled by default: x = "Universe" <<-MESSAGE Hello #{x} MESSAGE # => "Hello Universe"
Sometimes it seems a favicon does not work because your browser displays an old version or (in case of local...
TL;DR: You should generally use #size to count associated records. size Counts already loaded elements If the association is...
Given you use Capistrano together with bundler to automatically install your gems when deploying. I recently had the problem that...
Good collection of crash-course articles about founding a start up, getting funded, validating ideas, etc.
calc() lets you mix CSS units. Ever wanted to give an element "the container's width minus 20px on each...
tl;dr: Do not use merge! for session hashes. Use update instead. Outline Let's assume you're modifying the...
Safari & Chrome Use $x() in your console: $x('//span') # selects all span elements Firefox There's an add-on.
Watch out when saying something like 1.year in Rails. The result is not a Fixnum and can cause unexpected errors...
So you want to know if you are on natty, precise, quantal, or something else? Check /etc/lsb-release. $ cat /etc/lsb-release
Mozilla has announced that, starting with Firefox 22, the popular open source web browser will begin blocking third-party cookies...
Ruby 1.9 changed the default behavior of Module.const_defined? from what it was in Ruby 1.8 -- this can be especially...
See attached link for a way to extract the conditions of a named scope in Rails 2.3.
This error can happen in Ruby 1.9. To fix it, add the following line to the top of your .js.erb...
Rails 2.3.16+ on Ruby 1.9 causes warnings like this: .../gems/activesupport-2.3.17/lib/active_support/core_ext/string/output_safety.rb:22: warning: regexp match /.../n against to UTF-8 string...
JavaScripts and CSS should be minified for production use. In Rails 3.1+ the asset pipeline will take care of this...
Prepare to explain customers what changed if your application renders PDF documents to users.
So you have a method returning a regular expression but one case that should not yield a matching Regexp object...