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
gem sources -a http://gems.github.com | |
gem install aaronh-chronic --version=0.3.9 --no-ri --no-rdoc | |
gem install actionmailer --version=3.2.3 --no-ri --no-rdoc | |
gem install actionmailer --version=3.2.2 --no-ri --no-rdoc | |
gem install actionmailer --version=3.1.1 --no-ri --no-rdoc | |
gem install actionmailer --version=2.3.5 --no-ri --no-rdoc | |
gem install actionpack --version=3.2.3 --no-ri --no-rdoc | |
gem install actionpack --version=3.2.2 --no-ri --no-rdoc | |
gem install actionpack --version=3.1.1 --no-ri --no-rdoc | |
gem install actionpack --version=2.3.5 --no-ri --no-rdoc |
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
dates = [10 ,11, 12].map {|y| (1..12).map {|m| [1, ( m == 2 ? ((y % 4) == 0 ? 29 : 28) : ((m % 2) == 0 ? (m < 8 ? 30 : 31) : (m < 8 ? 31 : 30))), m, y] } } |
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
gem_cmd = ENV["GEM_CMD"] || 'sudo gem' | |
STDIN.map { |l| l.strip }.each { |l| | |
gem, versions = l.split(' ', 2) | |
versions = versions.gsub(/[\(\)]/, '').split(', ') | |
versions.each { |version| | |
cmd = "#{gem_cmd} install #{gem} -v #{version}" | |
puts cmd if ENV["PRETEND"] or ENV["ECHO"] | |
system cmd unless ENV["PRETEND"] |
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
# Better version from | |
# http://basic70tech.wordpress.com/2007/04/13/32-bit-ip-address-to-dotted-notation-in-ruby/ | |
[24, 16, 8, 0].map{|b| (1089052672 >> b) & 255}.join('.') |
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
gem 'compass-twitter-bootstrap-plugin', git: 'git://github.com/corroded/compass-twitter-bootstrap-plugin.git' |
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
<<COLORS | |
black='\033[0;30m' | |
BLACK='\033[1;30m' | |
red='\033[0;31m' | |
RED='\033[1;31m' | |
green='\033[0;32m' | |
GREEN='\033[1;32m' | |
yellow='\033[0;33m' | |
YELLOW='\033[1;33m' | |
blue='\033[0;34m' |
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
#!/usr/bin/env ruby | |
#gem_cmd = ENV["GEM_CMD"] || 'sudo gem' | |
gem_cmd = 'gem' | |
STDIN.map { |l| l.strip }.each { |l| | |
gem, versions = l.split(' ', 2) | |
versions = versions.gsub(/[\(\)]/, '').split(', ') | |
versions.each { |version| | |
cmd = "#{gem_cmd} install #{gem} -v #{version} --no-ri --no-rdoc" |
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
def ccn_valid?(number) | |
(number.to_s.split(//).inject([]){ |r,d| r << (r.count.even? ? (d.to_i * 2).to_s : d); r }.map{|d| d.split(//)}.flatten.inject(0){|sum,d| sum += d.to_i} % 10) == 0 | |
end | |
puts ccn_valid?("4417123456789113") |
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
# placed in config/initializers/paperclip.rb | |
module Paperclip | |
module InstanceMethods #:nodoc: | |
def save_attached_files | |
exceptions = [:scan] | |
each_attachment do |name, attachment| | |
if self.changed.include?("#{name}_updated_at") | |
logger.info("[paperclip] Saving attachments.") | |
attachment.send(:save) | |
unless exceptions.include?(name.to_sym) |
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 :rails_env, :production | |
set :unicorn_binary, "/usr/bin/unicorn" | |
set :unicorn_config, "#{current_path}/config/unicorn.rb" | |
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid" | |
namespace :deploy do | |
task :start, :roles => :app, :except => { :no_release => true } do | |
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D" | |
end | |
task :stop, :roles => :app, :except => { :no_release => true } do |