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
puts %x[gem list].split("\n").collect{|gem| gem[/\S+/]}.collect{|gem| "sudo gem install #{gem}" } |
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
sprintf(" %20.20s", data) |
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
ls -1 *.JPG |xargs -IZZ convert -resize 1600x1600 "ZZ" resized/ZZ |
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 advisor | |
@license = 'LTAM663SPJLO.945CWK-2XOI1X0-7L' | |
advisor = Advisor.find(params[:id]) | |
category = params[:category] | |
case category | |
when 'fixed' | |
chart_years = advisor.fixed_product_years.find_all_by_year(@year_num) | |
when 'combined' | |
chart_years = advisor.categorical_years.find_all_by_year(@year_num) | |
else |
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
## Rails development best practices | |
# An #RMM alternative, open and collaborative set of development practices we can adhere to. | |
* Distributed Version Control over relying on the File System | |
* Business Logic in the Models over being spread throughout the MVC layers | |
* RESTful Architecture over overloaded controllers | |
* KISS - Short methods with descriptive names | |
* Tests/Specs covering each layer of MVC and the whole stack | |
* Document the setup procedure (freeze dependancies where possible) |
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 'test/unit' | |
class TestQ | |
def count; 1; end | |
def question(question, type, options={}) | |
'<li>What is your favorite color?</li>' | |
end |
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
array = %w[apple banana carrot] | |
deleted = array.inject([]) do |deleted, food| | |
if food == 'apple' | |
deleted << array.delete(food) | |
end | |
deleted | |
end | |
p array # => ["banana", "carrot"] |
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
array = %w[apple banana carrot] | |
deleted = array.inject([]) do |deleted, food| | |
if food == 'apple' | |
deleted << array.delete(food) | |
end | |
deleted | |
end | |
p array # => ["banana", "carrot"] |
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
#!/bin/bash | |
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost | |
yum install -y l gcc-c++ zlib-devel openssl-devel | |
yum install -y mysql-server mysql-devel | |
/etc/init.d/mysqld start | |
yum install -y ruby rdoc ruby-devel | |
RUBYGEMS="rubygems-1.3.1" | |
wget http://rubyforge.org/frs/download.php/45905/$RUBYGEMS.tgz |
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
#!/bin/bash | |
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost | |
apt-get update | |
apt-get upgrade -y | |
apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev | |
apt-get -y install mysql-server libmysqlclient15-dev mysql-client | |
apt-get -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8 | |
RUBYGEMS=”rubygems-1.3.0″ |
OlderNewer