This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Put this in environments/development.rb | |
#enable sql queries for rails console | |
ActiveRecord::Base.logger = Logger.new(STDOUT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# add this method to enable method tableish in a different way | |
module WithinHelpers | |
def tableish(id) | |
find('table' + '#' + id).all('tr').map { |row| row.all('th, td').map { |cell| cell.text.strip } } | |
end | |
end | |
World(WithinHelpers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in config/application.rb | |
ActionMailer::Base.add_delivery_method :queued, Mail::QueuedDelivery | |
# in config/environment.rb | |
config.action_mailer.delivery_method = :queued | |
# in lib/mail/queued_delivery.rb | |
module Mail | |
class QueuedDelivery |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :max_asset_age, 2 ## Set asset age in minutes to test modified date against. | |
after "deploy:finalize_update", "deploy:assets:determine_modified_assets", "deploy:assets:conditionally_precompile" | |
namespace :deploy do | |
namespace :assets do | |
desc "Figure out modified assets." | |
task :determine_modified_assets, :roles => assets_role, :except => { :no_release => true } do | |
set :updated_assets, capture("find #{latest_release}/app/assets -type d -name .git -prune -o -mmin -#{max_asset_age} -type f -print", :except => { :no_release => true }).split |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('textarea[maxlength]').live('keyup blur', function() { | |
// Store the maxlength and value of the field. | |
var maxlength = $(this).attr('maxlength'); | |
var val = $(this).val(); | |
// Trim the field if it has content over the maxlength. | |
if (val.length > maxlength) { | |
$(this).val(val.slice(0, maxlength)); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
###################### | |
## SET CONFIGURATION | |
##################### | |
ENV['JAVA_HOME'] = '/usr/lib/jvm/java-6-openjdk-i386/' | |
APP_CONFIG = YAML.load_file(File.expand_path("./../../../config/instances/hcl.yml", __FILE__))[ARGV[0].to_s] | |
unless ARGV[0] | |
puts "Please pass on the environment param: development | test | production" | |
abort |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RomanNumber | |
ROMAN_NUMBER = { I: 1, | |
V: 5, | |
X: 10, | |
L: 50, | |
C: 100, | |
D: 500, | |
M: 1000 } | |
def initialize(roman) |