jhuston jhuston

View truncateAtWord.js
1 2 3 4 5 6 7 8 9 10
truncateAtWord = function(str){
var tail = "...",
len = arguments[1] || 10;
if(str.length <= len){
return str;
}
if(str.charAt(len) === " "){
return str.slice(0,len)+tail;
}
return str.slice(0,len).split(" ").slice(0,-1).join(" ")+tail;
View README.textile

This is a new version file /usr/bin/rails generated on my system by installing the Rails 3 Gem. The problem with this executable is that the ‘rails’ command no longer provided a way to execute the executables from Rails 2, because the bin had moved from Rails to Railties. A few more details in the related blog post.

Call a version of Rails 2 like so (after putting the following code in /usr/bin/rails):

rails _2.3.5_ myapp

The second file can be put in /usr/bin/rails2 as a convenience path to run the latest available Rails 2 version easily.

View I choo choo choose you.js
1 2 3 4 5 6 7 8 9 10
// Usage:
//
// $('#the-select').choose('Some Option');
//
// It'll throw an error if the option doesn't exist.
$.fn.choose = function(name) {
var elem = $(this);
if (elem.is(':not(select)')) { return elem; }
 
var option = elem.find('option').filter(function() {
Something went wrong with that request. Please try again.