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_token = Koala::Facebook::OAuth.new(FB_APP_ID,FB_SECRET).get_app_access_token | |
| graph = Koala::Facebook::API.new(app_token) | |
| graph.delete_object("#{request_id}_#{user_id}") |
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
| map = -> | |
| return unless this.users instanceof Array | |
| for user_id in this.users when !user_id.equals(current_user) | |
| emit(user_id, {interests_in_common: 1}) | |
| reduce = (user_id, emits) -> | |
| result = {interests_in_common: 0} | |
| result.interests_in_common += emit.interests_in_common for emit in emits | |
| result |
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
| require 'rubygems' | |
| require 'spork' | |
| Spork.prefork do | |
| # Loading more in this block will cause your tests to run faster. However, | |
| # if you change any configuration or code from libraries loaded here, you'll | |
| # need to restart spork for it take effect. | |
| # This file is copied to spec/ when you run 'rails generate rspec:install' |
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
| > rspec spec | |
| /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/util.rb:101:in `powerset': undefined method `to_set' for [#<Set:0x007fa9cb1c4810>]:Array (NoMethodError) | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/util.rb:759:in `def_static_method' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/buffer.rb:130:in `<class:Buffer>' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/buffer.rb:6:in `<module:Haml>' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/buffer.rb:1:in `<top (required)>' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/engine.rb:2:in `require' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml/engine.rb:2:in `<top (required)>' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1.3/lib/haml.rb:46:in `require' | |
| from /Users/jeffdeville/.rvm/gems/ruby-1.9.2-p290@wg/gems/haml-3.1. |
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
| def map_user(fbuser, token) | |
| user2 = User2.new | |
| %w[name email].each { |field| user2.send("#{field}=", fbuser[field]) } | |
| %w[first_name last_name birthday gender website timezone updated_time relationship_status locale third_party_id].each do |field| | |
| user2.profile.send("#{field}=", fbuser[field]) | |
| end | |
| %w[interests activities music books movies television likes games religion favorite_teams favorite_athletes inspirational_people sports].each do |field| | |
| next if fbuser[field].blank? |
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
| class ConsumerToken | |
| def self.make_facebook_public_profile_request(ids) | |
| begin | |
| response = Typhoeus::Request.get("https://graph.facebook.com/?fields=id,name,picture&ids=#{ids.join(',')}") | |
| JSON.parse(response.body) | |
| rescue | |
| HoptoadNotifier.notify( | |
| :error_class => "JSON Parse Error", | |
| :error_message => "JSON Parsing Error: ", | |
| :parameters => params |
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
| [2011-04-08 17:42:56] GEM_PATH="/Volumes/spinner/jeffdeville/.rvm/gems/ruby-1.9.2-p180:/Volumes/spinner/jeffdeville/.rvm/gems/ruby-1.9.2-p180@global:/Volumes/spinner/jeffdeville/.rvm/gems/ruby-1.9.2-p180@global" GEM_HOME="/Volumes/spinner/jeffdeville/.rvm/gems/ruby-1.9.2-p180" "/Volumes/spinner/jeffdeville/.rvm/rubies/ruby-1.9.2-p180/bin/ruby" "/Volumes/spinner/jeffdeville/.rvm/src/rubygems-1.4.2/setup.rb" | |
| /Volumes/spinner/jeffdeville/.rvm/src/rubygems-1.4.2/lib/rubygems/source_index.rb:62:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError) | |
| from /Volumes/spinner/jeffdeville/.rvm/src/rubygems-1.4.2/lib/rubygems/source_index.rb:52:in `from_installed_gems' | |
| from /Volumes/spinner/jeffdeville/.rvm/src/rubygems-1.4.2/lib/rubygems.rb:914:in `source_index' | |
| from /Volumes/spinner/jeffdeville/.rvm/src/rubygems-1.4.2/lib/rubygems/gem_path_searcher.rb:83:in `init_gemspecs' | |
| from /Volumes/spinner/jeffdeville/.rvm/src/rubygems-1.4.2/lib/rubygems/gem_path_searcher.rb:13:in `initialize' | |
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
| It should_map_all_fields = () => | |
| { | |
| GetUnmappedPropertiesFor<AdvertisementEditModel, Advertisement>() | |
| .ShouldContainOnly(new[] { "AdLayout" }); | |
| }; | |
| public static string[] GetUnmappedPropertiesFor<SRC,DEST>() | |
| { | |
| return AutoMapper.Mapper.FindTypeMapFor(typeof(SRC), typeof(DEST)).GetUnmappedPropertyNames(); | |
| } |
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
| class Hunch | |
| include HTTParty | |
| base_uri 'http://api.hunch.com/api/v1/' | |
| def get_recommendations(fb_id, price_range) | |
| options = {:query => {:auth_token => HUNCH_TOKEN, :friend_id => fb_id, :topic_ids => 'all_484,all_12834,all_76624,all_75594,all_24304,all_24284,all_12734,all_293104,all_394864,all_339804,all_75454,all_339814,all_24274,all_544,all_338474,all_339774,all_75634,all_24294,all_339794,all_24314', :limit => 10, :popularity => 0}} | |
| hunch_results = self.class.get('/get-recommendations', options) | |
| hunch_results["recommendations"].map{|result| to_gift_idea(result) } unless hunch_results["recommendations"].nil? | |
| [] |
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
| gifts = [ | |
| { | |
| image: "http://ecx.images-amazon.com/images/I/41MS0md3RJL._SL500_AA300_.jpg", | |
| asin: "-1", | |
| gifter_image: "/images/unknown_user.gif", | |
| gifter_id: -1 | |
| }, { | |
| image: "http://ecx.images-amazon.com/images/I/41MS0md3RJL._SL500_AA300_.jpg", | |
| asin: "-1", | |
| gifter_image: "/images/unknown_user.gif", |