Skip to content

Instantly share code, notes, and snippets.

View monkbroc's full-sized avatar

Julien Vanier monkbroc

View GitHub Profile
@monkbroc
monkbroc / devise.rb
Last active August 29, 2015 14:15
OmniAuth devise initializer
Devise.setup do |config|
# Other configuration...
# ==> OmniAuth
# Add a OmniAuth providers.
User.omniauth_providers.each do |provider_name|
if provider_name == :developer
config.omniauth :developer
else
api_key = ENV["#{provider_name.upcase}_API_KEY"]
@monkbroc
monkbroc / devise_create_users.rb
Created February 18, 2015 16:23
OmniAuth migration devise_create_users.rb
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Your your user fields
t.string :email, default: ""
## OmniAuth-able
t.string :provider
t.string :uid
# Replace this
Pusher.app_id = ENV['PUSHER_APP_ID']
Pusher.key = ENV['PUSHER_KEY']
Pusher.secret = ENV['PUSHER_SECRET']
# By this
Nenv :pusher do |p|
Pusher.app_id = p.app_id
Pusher.key = p.key
Pusher.secret = p.secret
if Nenv.enable_gc_profiling?
GC::Profiler.enable
end
@monkbroc
monkbroc / ugly_env_vars.rb
Last active August 29, 2015 14:13
Environment Variables
if ENV['ENABLE_GC_PROFILING'] == 'yes'
GC::Profiler.enable
end