Use this scope: class Stick named_scope :shuffled, lambda { last_record = last { :conditions => [ 'id >= ?', rand(last_record.id) ] } if last_record }

skorks.com

Ctrl + R Search commands you entered previously. Press Ctrl + R again to search further back, Ctrl + Shift + R searches forward...

This note describes how to setup a box running Ubuntu to share its Internet connection with another PC.

This returns the name (including path) of your current layout: response.layout => "layouts/admin" # inside views that are using the 'admin' layout...

I prefer the application that I'm currently working on to be reachable at http://localhost/. So when I switch...

When using form_for you can give the form's target URL either as a string or an array:

Note: We are talking about Machinist 1 here, Machinist 2 may have solved this or might require a different approach...

You need to install the following packages before you can build the Nokogiri gem: sudo apt-get install libxml2-dev...

If you want to see how long your database queries actually take, you need to disable MySQL's query cache...

timetobleed.com

This post will describe how I stumbled upon a code path in the Linux kernel which allows external programs to...

A good tool to generate strong passwords and secrets is "apg". You can get it with sudo apt-get install...

You need to install the following packages before you can build the Paperclip gem: sudo apt-get install imagemagick librmagick...

makandra dev

If a SSH shell dies (from timeout for example), you cannot kill it with the usual CTRL-C or CTRL...

makandra dev

Note that you should disable the Java plug-in in your browsers after installation. Ubuntu >= 12.04 Java 11

web.archive.org

With its you can switch the subject of an example to a method value of the current subject: describe Array...

When Paperclip attachments should only be downloadable for selected users, there are three ways to go. The same applies to...

If you need to find all files inside a directory that were modified in the last 24 hours you can...

Call with the server's hostname (and user if you have no SSH agent), e.g. install-gems-remotely my.server.com

gem-session.com

If you want to exclude your staging site from Google using robots.txt without running the risk to forget deleting the...

makandra dev

This is an awesome gadget in your toolbox, even if your test coverage is great. gem install ruby-debug (Ruby...

Sometimes files attain executable-flags that they do not need, e.g. when your Windows VM copies them over a Samba...

makandra dev

You may omit the /path/to/link_name to have a link with the same filename appear in the current directory

When working with times and dates in Rails applications, you need to deal with the following problem: In Rails, Time...