Skip to content

Instantly share code, notes, and snippets.

View captproton's full-sized avatar

captproton captproton

View GitHub Profile
@captproton
captproton / heroku error
Created October 26, 2010 19:59
heroku down?
$ git push heroku master
Counting objects: 102, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (88/88), done.
Writing objects: 100% (92/92), 1.17 MiB, done.
Total 92 (delta 7), reused 0 (delta 0)
-----> Heroku receiving push
-----> Rails app detected
-----> Gemfile detected, running Bundler version 1.0.0
@captproton
captproton / refinerycms app creation
Created October 26, 2010 23:45
how to create a refinerycms app with the rails 3 gem
STEPS TO QUICKLY GENERATE REFINERY WITH ORIGINAL THEME AND PORTFOLIO
===
refinerycms APPNAME -g refinerycms-theming,refinerycms-portfolio --heroku APPNAME_ON_HEROKU
cd APPNAME
heroku config:add S3_BUCKET=MYBUCKET S3_KEY=MYKEY S3_SECRET=MYSECRET
Started GET "/refinery/pages" for 98.210.200.138 at Tue Oct 26 16:40:55 -0700 2010
Processing by Admin::PagesController#index as HTML
Parameters: {"locale"=>:en}
Rendered themes/rainforest/views/shared/admin/_search.html.erb (0.4ms)
Rendered .bundle/gems/ruby/1.8/gems/refinerycms-0.9.8.5/vendor/refinerycms/pages/app/views/admin/pages/_page.html.erb (25.1ms)
Rendered .bundle/gems/ruby/1.8/gems/refinerycms-0.9.8.5/vendor/refinerycms/pages/app/views/admin/pages/_page.html.erb (125.3ms)
Rendered .bundle/gems/ruby/1.8/gems/refinerycms-0.9.8.5/vendor/refinerycms/pages/app/views/admin/pages/_page.html.erb (5.4ms)
Rendered .bundle/gems/ruby/1.8/gems/refinerycms-0.9.8.5/vendor/refinerycms/pages/app/views/admin/pages/_page.html.erb (386.7ms)
Rendered themes/rainforest/views/shared/admin/_sortable_list.html.erb (0.5ms)
Rendered .bundle/gems/ruby/1.8/gems/refinerycms-0.9.8.5/vendor/refinerycms/pages/app/views/admin/pages/_sortable_list.html.erb (465.2ms)
@captproton
captproton / _content_page
Created October 27, 2010 18:28
rails 2 refinerycms content_page
<%
show_empty_sections ||= false
remove_automatic_sections ||= false
body_content_title = page_title if (body_content_title = yield :body_content_title).blank? and !show_empty_sections and !remove_automatic_sections
body_content_left = @page[:body] if (body_content_left = yield :body_content_left).blank? and !show_empty_sections and !remove_automatic_sections and @page.present?
body_content_right = @page[:side_body] if (body_content_right = yield :body_content_right).blank? and !show_empty_sections and !remove_automatic_sections and @page.present?
extra_body_content_classes = []
extra_body_content_classes << "no_title" if body_content_title.blank?
@captproton
captproton / _menu_branch refinerycms
Created October 27, 2010 18:42
partial with problem
<%
css = if ((defined?(apply_css) && apply_css) || !defined?(apply_css)) and
(classes = css_for_menu_branch(menu_branch, menu_branch_counter, sibling_count||=nil)).any?
"class='#{classes.join(' ')}'"
end
dom_id = ("id='item_#{menu_branch_counter}'" if menu_branch.parent_id.nil? and menu_branch.title.present?)
hide_children = (defined?(hide_children) && hide_children)
children = hide_children ? [] : collection.select { |p| p.parent_id == menu_branch.id && p.in_menu? }
-%>
NameError in Dashboard#index
Showing /Users/heathertanner/Sites/rails/osskids2/app/views/dashboard/_feed_item.html.erb where line #63 raised:
undefined local variable or method `small' for #<#<Class:0x3d8db0c>:0x3d8cbf8>
Extracted source (around line #63):
60: :loading => "http://l.yimg.com/cc/img/global/1287689716/dash_loader.gif",
61: :original => feed_item.meme.media.url(:medium),
62: :title => feed_item.meme.body.html_safe ,
def show
render :json => {:taken => username_taken(params[:username])}
end
def username_taken(username)
user = User.where("username = ?", params[:username]).first
if user.present?
return true
@captproton
captproton / gist:700760
Created November 15, 2010 18:45
error signing into refinerycms
Started POST "/session" for 98.210.200.138 at Mon Nov 15 10:41:54 -0800 2010
Processing by SessionsController#create as HTML
Parameters: {"commit"=>"Sign in", "continue_editing"=>"false", "session"=>{"remember_me"=>"0", "password"=>"[FILTERED]", "login"=>"captproton"}, "modal"=>"false", "authenticity_token"=>"XrQlWnnZ2DU4YKpZRuROgkdZo/CuaIScK6Y0s9KqHFE=", "utf8"=>"\342\234\223", "locale"=>:en, "dialog"=>"false"}
Completed in 4ms
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
@captproton
captproton / gist:700842
Created November 15, 2010 19:50
heroku postgresdb backup plugin install error
$ heroku plugins:install git://github.com/heroku/heroku-postgresql.git
There is no candidate for rebasing against among the refs that you just fetched.
Generally this means that you provided a wildcard refspec which had no
matches on the remote end.
Could not install heroku-postgresql. Please check the URL and try again
@captproton
captproton / adding 301 and 302 redirects to RefineryCMS
Created November 24, 2010 22:50
a tutorial on how to easily add redirects to Refinery CMS
If you have a new site that the search engines don't know about, then Refinery CMS is perfectly set up after the install, but what if you are upgrading a site to Refinery that was based on another technology? Not all of the pages will have the same url's. You will need some redirects to the pages you create or you will lose that precious SEO juice that the previous site worked so hard to get.
One tack to take is to add some middleware, specifically Rack::Rewrite. Here are the three easy steps:
1) install the Rack::Rewrite gem (http://rubygems.org/gems/rack-rewrite)
2) At the bottom of the Gemfile:
# USER DEFINED
gem 'rack-rewrite', '~> 1.0.2'
3) in application.rb: