This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/user.rb | |
def apply_omniauth(omniauth) | |
case omniauth['provider'] | |
when 'facebook' | |
self.apply_facebook(omniauth) | |
when 'twitter' | |
self.apply_twitter(omniauth) | |
end | |
authentications.build(hash_from_omniauth(omniauth)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/models/user.rb | |
def apply_omniauth(omniauth) | |
case omniauth['provider'] | |
when 'facebook' | |
self.apply_facebook(omniauth) | |
end | |
authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid'], :token =>(omniauth['credentials']['token'] rescue nil)) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using custom set_form_data and urlencode | |
# Ruby NET/HTTP does not support duplicate parameter names | |
# File net/http.rb, line 1426 | |
def set_form_data(request, params, sep = '&') | |
request.body = params.map {|k,v| | |
if v.instance_of?(Array) | |
v.map {|e| "#{urlencode(k.to_s)}=#{urlencode(e.to_s)}"}.join(sep) | |
else | |
"#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bundle_mongo_template.rb | |
# | |
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842) | |
# | |
# This template: | |
# - Adds Bundler support | |
# - Adds MongoDB support | |
# - Removes default files and javascript | |
# - Installs common gems via bundler: mocha, shoulda, factory-girl, shoulda_generator, haml, mongrel | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/chef/attributes/chef.rb | |
set_unless[:chef][:log_location] = "STDOUT" | |
set_unless[:chef][:log_level] = "info" | |
set_unless[:chef][:url_type] = "http" | |
set_unless[:chef][:server_fqdn] = "your-chef-server" | |
set_unless[:chef][:server_port] = "4000" | |
set_unless[:chef][:validation_client_name] = "chef-validator" | |
set_unless[:chef][:cache_path] = "/var/cache/chef" |
NewerOlder