Skip to content

Instantly share code, notes, and snippets.

View lodestone's full-sized avatar
:octocat:
🤘Grokking Out 🤘

Matt Petty lodestone

:octocat:
🤘Grokking Out 🤘
View GitHub Profile
puts %x[gem list].split("\n").collect{|gem| gem[/\S+/]}.collect{|gem| "sudo gem install #{gem}" }
sprintf(" %20.20s", data)
ls -1 *.JPG |xargs -IZZ convert -resize 1600x1600 "ZZ" resized/ZZ
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
## 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)
require 'test/unit'
class TestQ
def count; 1; end
def question(question, type, options={})
'<li>What is your favorite color?</li>'
end
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"]
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"]
#!/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
#!/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″