Skip to content

Instantly share code, notes, and snippets.

@DixcomWeb
DixcomWeb / pages_controller.rb
Created Apr 18, 2012 — forked from patrickberkeley/pages_controller.rb
using Paperclip for multiple attachments and displaying them using the method described in Advanced Rails Recipe #13
View pages_controller.rb
class PagesController < ApplicationController
before_filter :login_required, :except => [ :show ]
# GET /pages
# GET /pages.xml
def index
@pages = Page.find(:all)
respond_to do |format|
format.html # index.html.erb
@DixcomWeb
DixcomWeb / confident.rb
Created May 21, 2011 — forked from afair/confident.rb
Notes on Advi Grimm's "Confident Code" talk
View confident.rb
# http://avdi.org/talks/confident-code-2010-01-12/confident-code.html
# Narrative structure: Four Parts
#==========================================================
# Gather input:
# Coerce
param.to_s #to_i #to_sym Array() ... use liberally!
messages = Array(messages)
# Decorators
@DixcomWeb
DixcomWeb / News Cloud DB Setup
Created Feb 7, 2011
Most of the necessary installs and configurations for setting up a News Cloud Mongo server
View News Cloud DB Setup
# Update and install required packages
sudo aptitude update
sudo aptitude safe-upgrade
@DixcomWeb
DixcomWeb / News Cloud App Setup
Created Feb 7, 2011
Most of the necessary installs and configurations for setting up a News Cloud EC2 instance
View News Cloud App Setup
# Update and install packages
sudo aptitude update
sudo aptitude safe-upgrade
sudo aptitude install apache2 build-essential libapache2-mod-passenger linux-headers-generic git-core zlib1g-dev libmysqlclient-dev
# Install Latest Ruby
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz
tar -xzf ruby-1.9.2-p136.tar.gz
rm -f ruby-1.9.2-p136.tar.gz
cd ruby-1.9.2-p136/
View Gemfile
gem 'sunspot_rails', :require => 'sunspot/rails'
View deploy.rb
# ...
namespace :bundler do
task :create_symlink, :roles => :app do
shared_dir = File.join(shared_path, 'bundle')
release_dir = File.join(current_release, '.bundle')
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
end
task :bundle_new_release, :roles => :app do