Skip to content

Instantly share code, notes, and snippets.

View sumitngupta's full-sized avatar

Sumit Gupta sumitngupta

View GitHub Profile
namespace :quotes do
desc 'Import data from the Ted API'
task :import_data => :environment do
# here is where you put the code to hit your Quote model.
still_has_data = true
page = 0
while still_has_data do
Quote.save_data_from_api(do something with the page variable to move the offset here)
namespace :quotes do
desc 'Import data from the Ted API'
task :import_data do
end
end
irb(main):009:0> f = Food.first
=> #<Food id: 577, name: "Apple", category: "Fruit", created_at: "2014-01-16 22:31:55", updated_at: "2014-01-17 18:07:11", approved: true, misspelled_for_id: nil, user_id: nil, food_colors: {"red"=>"0", "green"=>"1", "yellow"=>"0"}, icon_file_name: nil, icon_content_type: nil, icon_file_size: nil, icon_updated_at: nil, icon_retina_file_name: nil, icon_retina_content_type: nil, icon_retina_file_size: nil, icon_retina_updated_at: nil>
irb(main):010:0> f.icon.url
=> "https://kurbo-assets.s3.amazonaws.com/foodicons/default.png"
irb(main):011:0> f.icons(:normal)
=> "https://kurbo-assets.s3.amazonaws.com/assets/foodicons/default-ea2ae39e01af613d93282068d7ae4899.png"
module JsonApiHelpers
def json_response
@json_response ||= JSON.parse(response.body)
end
end
RSpec.configure do |config|
config.include JsonApiHelpers, type: :controller
end
<!DOCTYPE html><html><head><meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title>Denied! - The Week in Pictures for June 3-June 9, 2013 - ESPN</title><meta property="og:title" content="Denied! - The Week in Pictures for June 3-June 9, 2013" /><meta name="description" content="LeBron James blocks Tiago Splitter's dunk attempt during Game 2 of the NBA Finals on Sunday. Miami beat the Spurs 103-84." /><meta property="og:description" content="LeBron James blocks Tiago Splitter's dunk attempt during Game 2 of the NBA Finals on Sunday. Miami beat the Spurs 103-84." /><link rel="canonical" href="http://espn.go.com/espn/photos/gallery/_/id/9359908/image/1/denied-week-pictures-june-3-june-9-2013" /><meta property="og:url" content="http://espn.go.com/espn/photos/gallery/_/id/9359908/image/1/denied-week-pictures-june-3-june-9-2013" /><meta property="og:image" content="http://a.espncdn.com/photo/2013/0609/play_wip_33.jpg" />
{ :game =>
{
:creator_id => GUY_WHO_CREATED_THIS_ID,
:game_players_attributes => [
{:player_id => PLAYER_1_ID},
{:player_id => PLAYER_2_ID},
{:player_id => PLAYER_3_ID}
]
}
}
2013-04-23T02:07:40.561026+00:00 app[web.1]: Started GET "/auth/facebook" for 71.202.152.243 at 2013-04-23 02:07:40 +0000
2013-04-23T02:07:40.671382+00:00 app[web.1]: (facebook) Request phase initiated.
2013-04-23T02:07:40.714235+00:00 heroku[router]: at=info method=GET path=/auth/facebook host=badfriends.herokuapp.com fwd="71.202.152.243" dyno=web.1 connect=2ms service=212ms status=302 bytes=252
2013-04-23T02:07:44.051594+00:00 app[web.1]: Started GET "/auth/facebook/callback?code=AQCJCF93W45_JjIlc4S1eWvM6B2AJtI2QKadU_Ja4ZidPZ8eXv2xLkeT5OL8Psw6j3Ur31QJq8rF3aDLKzixDk629omQs1Y3w2il6sKaBOgRpOQhXRZhUUR6884jYm2ii011W0rNlbzjetydiatabNN1Hty9_gRzep-aiYAglI9vxH6krJzSRe44AUHVTTkcpjo&state=c075110cdf21df01ad36dded625655a7351225a52e9b0475" for 71.202.152.243 at 2013-04-23 02:07:44 +0000
2013-04-23T02:07:44.054710+00:00 app[web.1]: (facebook) Callback phase initiated.
2013-04-23T02:07:44.443335+00:00 app[web.1]: Parameters: {"code"=>"AQCJCF93W45_JjIlc4S1eWvM6B2AJtI2QKadU_Ja4ZidPZ8eXv2xLkeT5OL8Psw6j3Ur31QJq8rF3aDLKzixDk
Completed 200 OK in 61ms (Views: 0.1ms | ActiveRecord: 12.7ms)
Connecting to database specified by database.yml
Connecting to database specified by database.yml
(0.8ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
Migrating to CreateWhiteCards (20130302084020)
Migrating to CreateBlackCards (20130329130506)
Migrating to CreatePlayers (20130329144540)
Migrating to CreateGames (20130329152454)
Migrating to CreateGamePlayers (20130330153622)
Migrating to CreateRounds (20130331223328)
sumit at Sumits MBP in ~/badfriends on rails4*
$ rake rails4:check
*** Mocha deprecation warning: Change `require 'mocha'` to `require 'mocha/setup'`.
** GEM COMPATIBILITY CHECK **
No gem incompatibilities found
sumit at Sumits MBP in ~/badfriends on rails4*
$ rake rails4:check_gems
commit 65b7ecd6637a6f83043c988c86c1837a87a9a027
Author: Kristine Robison <kris@tout.com>
Date: Wed Aug 15 14:46:55 2012 -0700
Fixed a missing reference
commit 687bac13b79723f26df8c7e0952dd46eba724db2
Author: Kristine Robison <kris@tout.com>
Date: Wed Aug 15 09:35:49 2012 -0700