Skip to content

Instantly share code, notes, and snippets.

View bsbodden's full-sized avatar

Brian Sam-Bodden bsbodden

View GitHub Profile
@bcardarella
bcardarella / gist:1040967
Created June 22, 2011 19:43 — forked from theflowglenn/gist:1040942
Snippet from Rails 3 Client Side Validations JS to allow for AJAX spinner
// Set up the events for the form
form
.submit(function() { return form.isValid(settings.validators); })
// added loading toggle to handle the feedback spinner image (and changed 'beforeSend' to just 'before')
.bind('ajax:before', function() { $("#loading").toggle(); return form.isValid(settings.validators); })
.bind('ajax:success', function() { $("#loading").toggle(); })
// Callbacks
.bind('form:validate:after', function(eventData) { clientSideValidations.callbacks.form.after( form, eventData); })
.bind('form:validate:before', function(eventData) { clientSideValidations.callbacks.form.before(form, eventData); })
@PanosJee
PanosJee / refinery_omniauth.rb
Created March 17, 2011 22:58
Login / Register to Refinery with Omniauth (facebook, twitter, openid, etc)
# Create a role user (no perms). Fire up the console rails c
$> Role.create(:title=>'User')
# In your Gemfile add
gem 'oa-oauth', :require => 'omniauth/oauth'
# At the beginning of devise.rb. You can also create a yaml file and instantiate when Rails begin
# For shake of simplicity I added the credentials at devise.rb
Facebook = Rails.env.development? ? {:app_id => 2621xxx, :secret => 'e81f33d042xxxxx'} :
{:app_id => 1749xxx9, :secret => '13c11be6628dc1xxxx'}