Skip to content

Instantly share code, notes, and snippets.

View joemsak's full-sized avatar

Joe Sak joemsak

View GitHub Profile
We couldn’t find that file to show.
<div class='field'>
<%= f.label :image -%>
<%= render :partial => "/shared/admin/image_picker", :locals => {
:f => f,
:field => :image_id,
:image => @blog_post.image,
:toggle_image_display => false
} %>
</div>
sections = [{:yield => :body_content_top, :fallback => nil},
{:yield => :body_content_title, :fallback => page_title, :title => true}]
class Comic < ActiveRecord::Base
default_scope :order => 'position ASC'
has_many :comic_pages
def min_comic_position
(comics.last.try(:position) || -1) + 1
end
acts_as_indexed :fields => [:title, :body]
@joemsak
joemsak / heroku_compass.rb
Created April 28, 2011 17:13
With the latest compass config/compass.rb has a railtie now. Heroku instructions go here now.
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
environment = Compass::AppIntegration::Rails.env
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets"))
Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
:urls => ['/stylesheets'],
:root => "#{Rails.root}/tmp")
http_path = '/'
ERROR ArgumentError: wrong number of arguments (0 for 1)
/Users/joe/.rvm/gems/ruby-1.9.2-head@refinery/gems/railties-3.0.7/lib/rails/application.rb:167:in `call'
/Users/joe/.rvm/gems/ruby-1.9.2-head@refinery/gems/railties-3.0.7/lib/rails/application.rb:77:in `method_missing'
(eval):3:in `method_missing'
/Users/joe/.rvm/gems/ruby-1.9.2-head@refinery/gems/railties-3.0.7/lib/rails/rack/log_tailer.rb:14:in `call'
/Users/joe/.rvm/gems/ruby-1.9.2-head@refinery/gems/rack-1.2.2/lib/rack/content_length.rb:13:in `call'
/Users/joe/.rvm/gems/ruby-1.9.2-head@refinery/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in `service'
/Users/joe/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/joe/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/joe/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
@joemsak
joemsak / _footer.html.erb
Created May 24, 2011 15:51
Using jQuery TokenInput with ActsAsTaggableOn
@joemsak
joemsak / example_class.rb
Created May 24, 2011 16:09
instance has?
class Example < ActiveRecord::Base
#...
# would this be cool to have, or am I daft?
def has? *args
args.any? { |a| send(a.to_sym) }
end
# irc chan said to drop the to_sym but I like having the failsafe
source 'http://rubygems.org'
gem 'rails', '3.0.8'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'refinerycms-calendar'
update: function(event, ui) {
$('.odd, .even').removeClass('odd even');
$('.item').each(function(index) {
index += 1;
if (index % 2 === 0) {
$(this).addClass('even');
}
if (index % 2 !== 0) {
return $(this).addClass('odd');
}