Skip to content

Instantly share code, notes, and snippets.

View rafaelcgo's full-sized avatar

Rafael Oliveira rafaelcgo

View GitHub Profile
@rafaelcgo
rafaelcgo / Criando Manifest específico para cada Layout-README
Last active August 29, 2015 14:02
Criando Manifest específico para cada Layout
Crie a pasta stylesheets/pdf
Coloque os .css.scss que deseja lá dentro
Crie um stylesheets/pdf_manifest.css.sccs
Inclua os .css que precisar no manifest (*= require)
Adicione a regra de compilação no production.rb
Carregue o manifest que deseja no layout específico.
@rafaelcgo
rafaelcgo / photos_helper.rb
Created August 13, 2013 19:42
The URL goes like this: http://localhost:3000/admin/photos?utf8=%E2%9C%93&tag=6
URL goes like this:
http://localhost:3000/admin/photos?utf8=%E2%9C%93&tag=6
@rafaelcgo
rafaelcgo / event.rb
Last active December 21, 2015 00:29
How to make place2.rb into only 1 query?
class Event < ActiveRecord::Base
belongs_to :owner, class_name: 'User', foreign_key: 'user_id'
belongs_to :place
has_many :photos, as: :parent
validates_presence_of :name, :owner
end
@rafaelcgo
rafaelcgo / new_photos_create.rb
Created June 27, 2012 20:20
Create Multiple Photos
new_photos.each do |p|
Photo.create(:filename => p, :version => params[:version].to_i+1, :client_id => params[:client_id].to_i)
end
@users = User.where(:page_owner => true).order("updated_at DESC").limit(100) if params[:page_owner]
@users = User.where(:page_owner_request => true}.order("updated_at DESC").limit(100) if params[:page_owner_request]
@users = User.where(:deleted => true}.order("updated_at DESC").limit(100) if params[:deleted]
@users = @users || User.all
@rafaelcgo
rafaelcgo / gist:2919881
Created June 12, 2012 20:16
Compass.sass_plugin_configuration[:template_location] OUTPUT
[
["/Users/rafaeloliveira/Development/Rails/sharespot-production/app/assets/stylesheets", "/Users/rafaeloliveira/Development/Rails/sharespot-production/public/assets"],
["/Users/rafaeloliveira/.rvm/gems/ruby-1.9.2-p290@r310totem-simpleforms/gems/compass-0.12.1/frameworks/blueprint/stylesheets", "/Users/rafaeloliveira/Development/Rails/sharespot-production/public/assets/blueprint"],
["/Users/rafaeloliveira/.rvm/gems/ruby-1.9.2-p290@r310totem-simpleforms/gems/compass-0.12.1/frameworks/compass/stylesheets", "/Users/rafaeloliveira/Development/Rails/sharespot-production/public/assets/compass"]
]
@rafaelcgo
rafaelcgo / heroku.yml
Created November 17, 2011 19:59
Heroku.yml config for Heroku_san Gem
production:
app: xxxxxxxxx
stack: bamboo-ree-1.8.7
config:
BUNDLE_WITHOUT: "development:test"
GOOGLE_ANALYTICS: "xxxxxxxxxxxxxx"
PUSHER_SOCKET_URL: "xxxxxxxxxxxxxx"
PUSHER_URL: "xxxxxxxxxxxxxx"
RACK_ENV: "production"
WEBSOLR_URL: "xxxxxxxxxxxxxx"
@rafaelcgo
rafaelcgo / Full Stack
Created November 8, 2011 17:22
Gist for Rails Admin #821
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/rafaeloliveira/.rvm/gems/ruby-1.8.7-p352@rails310/gems/activerecord-3.1.0/lib/active_record/base.rb:1082:in `method_missing': undefined local variable or method `acts_as_messageable' for #<Class:0x108d1d428> (NameError)
from /Users/rafaeloliveira/Development/Rails/mural/hollow/app/models/user.rb:22
from /Users/rafaeloliveira/.rvm/gems/ruby-1.8.7-p352@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:456:in `load'
from /Users/rafaeloliveira/.rvm/gems/ruby-1.8.7-p352@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:456:in `load_file'
from /Users/rafaeloliveira/.rvm/gems/ruby-1.8.7-p352@rails310/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'