Skip to content

Instantly share code, notes, and snippets.

View Ravenna's full-sized avatar

Ravenna Ravenna

View GitHub Profile
@Ravenna
Ravenna / gist:1383514
Created November 21, 2011 18:46
log output
* executing "cd /home/emeraldcityguitars/emeraldcityguitars.com/releases/20111121184155 && bundle install --gemfile /home/emeraldcityguitars/emeraldcityguitars.com/releases/20111121184155/Gemfile --path /home/emeraldcityguitars/emeraldcityguitars.com/shared/bundle --deployment --quiet --without development test"
servers: ["blackhawks.dreamhost.com"]
[blackhawks.dreamhost.com] executing command
*** [err :: blackhawks.dreamhost.com] sh: bundle: command not found
command finished in 68ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/emeraldcityguitars/emeraldcityguitars.com/releases/20111121184155; true"
servers: ["blackhawks.dreamhost.com"]
[blackhawks.dreamhost.com] executing command
command finished in 102ms
@Ravenna
Ravenna / gist:1384042
Created November 21, 2011 21:42
deploy.rb
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
set :application, "Emerald City Guitars"
set :repository, "git://github.com/Ravenna/ecg.git"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
# set :deploy_to, "/var/www/#{application}"
@Ravenna
Ravenna / gist:1384046
Created November 21, 2011 21:43
production.rb
set :user, 'emeraldcityguitars'
#This is to help with the deployment
set :domain, 'emeraldcityguitars.com'
set :deploy_to, "/home/#{user}/#{domain}"
set :use_sudo, false
role :app, "blackhawks.dreamhost.com"
@Ravenna
Ravenna / gist:1386908
Created November 22, 2011 20:50
brand#show
@category = Category.find_by_url_name(params[:category_id])
@brand = Brand.find(params[:id])
@search = Product.order(params[:order] || :descend_by_price).find(:all, :conditions => {:brand_id => @brand.id, :category_id => @category.id})
@products = @search.paginate(:page => params[:page])
Started POST "/redemptions" for 127.0.0.1 at 2011-11-27 20:23:53 -0800
Processing by RedemptionsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"RMLPq3s2KbZHBDkj7j1lL29fJD/hO8qik+iBMWtxQBU=", "redemption"=>{"code_id"=>"fc6f58"}, "commit"=>"Submit"}
User Load (3.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
(2.1ms) BEGIN
(0.2ms) COMMIT
(2.4ms) BEGIN
(0.1ms) ROLLBACK
Redirected to http://localhost:3000/bands
Completed 302 Found in 130ms
<div><img src="http://ROOT URL/wp-contents/themes/digipen/images/layout/sidebar_calendar_top_bg.png" /></div>
<div id="sidebar_cal_middle">
<p id="cal_icon"><img src="http://ROOT URL/wp-contents/themes/digipen/images/calendar_icon.jpg" /></p>
<!-- Put Content here
</div>
<div><img src="http://ROOT URL/wp-contents/themes/digipen/images/layout/sidebar_bottom_bg.png" /></div>
@Ravenna
Ravenna / gist:1474173
Created December 13, 2011 22:20
authenitcate_helper
session_start();
if(get_cookie('bob_session')==''){
$this->session->set_flashdata("redirect",uri_string());
redirect("/login");
}
else{
$login = explode("|",get_cookie("bob_session"));
if(count($login)>1){
$sql = "Select id, email, password, admin, smt From employee Where email='".SQLIn(decrypt($login[0]))."' And password='".SQLIn($login[1])."'";
$user = SQLObj($sql);
Started POST "/recommendations" for 127.0.0.1 at 2011-12-19 12:25:25 -0800
Processing by RecommendationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"yKCt6qc4zrEuswl9Kn45/mU/2o1bYrZ2L6LX4E6uT+U=", "recommendation"=>{"nominee"=>"TJ Sherrill", "award_id"=>"1"}, "approval"=>{"email"=>"jess@ravennainteractive.com"}, "commit"=>"Create Recommendation", "has_many"=>:approvals}
(0.1ms) BEGIN
SQL (40.9ms) INSERT INTO "recommendations" ("award_id", "created_at", "nominee", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id" [["award_id", 1], ["created_at", Mon, 19 Dec 2011 20:25:25 UTC +00:00], ["nominee", "TJ Sherrill"], ["updated_at", Mon, 19 Dec 2011 20:25:25 UTC +00:00]]
(0.6ms) COMMIT
Redirected to http://localhost:300
@Ravenna
Ravenna / gist:1502681
Created December 20, 2011 18:41
routes
resources :recommendations, :has_many => :approvals
resources :recommendations do
resources :approvals
end
@Ravenna
Ravenna / gist:1514687
Created December 23, 2011 16:37
registrations_controller.rb
class RegistrationsController < Devise::RegistrationsController
def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
# If the user has filled in any of the password fields, we'll update their password
any_passwords = %w(password password_confirmation current_password).any? do |field|
params[resource_name][field].present?
end
update_method = any_passwords ? :update_with_password : :update_without_password