This file contains 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 install | |
Fetching source index from http://rubygems.org/ | |
Using rake 10.1.0 | |
Using i18n 0.6.5 | |
Using minitest 4.7.5 | |
Using multi_json 1.8.1 | |
Using atomic 1.1.14 | |
Using thread_safe 0.1.3 | |
Using tzinfo 0.3.38 | |
Using activesupport 4.0.0 |
This file contains 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
public class HomeController : Controller | |
{ | |
public ActionResult Index() | |
{ | |
return Json(true, JsonRequestBehavior.AllowGet); | |
} | |
} |
This file contains 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
var connect = require('connect'); | |
var querystring = require('querystring'); | |
var utils = require('util'); | |
connect.createServer( | |
connect.static(__dirname) | |
).use(function(req, res){ | |
if (req.method == 'POST') { | |
console.log("[200] " + req.method + " to " + req.url); | |
var fullBody = ''; |
This file contains 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
class User < ActiveRecord::Base | |
def fetch_facebook_image | |
return false if authentications.blank? | |
auth = authentications.find_by_provider('facebook') | |
remote_image_url = "https://graph.facebook.com/#{auth.uid}/picture?type=large" | |
self.save | |
end | |
end |
This file contains 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
namespace :images do | |
desc "populating user.image" | |
task :pull => :environment do | |
print "This task will pull FB images into user.image if user has fb authentications. Confirm? [y/n]: " | |
answer = $stdin.gets.chomp() | |
if answer == 'y' | |
# User.all.each do |u| | |
u = User.find(50) | |
if !u.authentications.blank? | |
# grab the image from facebook and store it in the cloud. |