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
-- | |
Parameters: {"tags"=>"nba,los-angeles-lakers,australia-cricket,cricket,wwe,cold-hard-facts", "nba-fantasy"=>"kobe-bryant,lebron-james", "last_request"=>"1395961708", "locale"=>"en_AU", "tz"=>"34200"} | |
Started GET "/api/v1/team_streams/philadelphia-eagles.json?appversion=3.3.1&devicetype=iphone&locale=en_US&tz=-14400" for 165.254.159.205 at 2014-04-10 23:08:28 +0000 | |
Completed 200 OK in 229.8ms (Views: 0.2ms | ActiveRecord: 103.8ms) | |
Processing by Api::V1::TeamStreamsController#show as JSON | |
Parameters: {"appversion"=>"3.3.1", "devicetype"=>"iphone", "locale"=>"en_US", "tz"=>"-14400", "id"=>"philadelphia-eagles"} | |
%%%D | |
1 2014-04-10 21:38:33 UTC | |
2 ActiveSupport::TimeWithZone | |
3 "2014-04-10T21:38:33Z" |
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
➜ ~ curl http://ec2-54-237-184-72.compute-1.amazonaws.com/api/v1/push_notifications\?tags\=bangladesh-cricket,new-york-yankees,cold-hard-facts\&last_request\=1395793685\&locale\=en_US\&tz\=-25200 --verbose | |
* Adding handle: conn: 0x7ffba1804000 | |
* Adding handle: send: 0 | |
* Adding handle: recv: 0 | |
* Curl_addHandleToPipeline: length: 1 | |
* - Conn 0 (0x7ffba1804000) send_pipe: 1, recv_pipe: 0 | |
* About to connect() to ec2-54-237-184-72.compute-1.amazonaws.com port 80 (#0) | |
* Trying 54.237.184.72... | |
* Connected to ec2-54-237-184-72.compute-1.amazonaws.com (54.237.184.72) port 80 (#0) | |
> GET /api/v1/push_notifications?tags=bangladesh-cricket,new-york-yankees,cold-hard-facts&last_request=1395793685&locale=en_US&tz=-25200 HTTP/1.1 |
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
def previous_game_date | |
@previous_game_date ||= if Score.cached_previous_league_game(@params[:league], @params[:sport], @tz, @date) | |
Time.parse(Score.cached_previous_league_game(@params[:league], @params[:sport], @tz, @date)["startTime"]).in_time_zone(@tz) | |
elsif GameFinder.new.previous_game_before_date(@params[:league], @params[:sport], @tz, @date) | |
GameFinder.new.previous_game_before_date(@params[:league], @params[:sport], @tz, @date)["starts_at"].in_time_zone(@tz) | |
else | |
@date-1.day | |
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
{"items":[{"type":"Tweet","id":11083421,"tag":8248,"publishedAt":"2014-03-20T17:46:13Z","programmedAt":"2014-03-20T17:46:13Z","permalink":"https://twitter.com/DarnellMayberry/status/446704276488720384","twitterHandle":"DarnellMayberry","twitterText":"RT @NewsOKSports: Reasons to believe Russell Westbrook will sit tonight against Cleveland (via @darnellmayberry): http://t.co/LCxlOj4LkI","twitterProfileImageMini":"http://pbs.twimg.com/profile_images/277780584/meandthecommish_mini.jpg","twitterProfileImageNormal":"http://pbs.twimg.com/profile_images/277780584/meandthecommish_normal.jpg","twitterProfileImageBigger":"http://pbs.twimg.com/profile_images/277780584/meandthecommish_bigger.jpg","fullName":"Darnell Mayberry","gameUpdate":false},{"type":"Article","id":1998814,"originalArticleId":1998814,"title":"Kevin Durant's Scoring Binge Hiding What Makes Him Special NBA Superstar ","tag":"oklahoma-city-thunder","publishedAt":"2014-03-19T21:11:38Z","programmedAt":"2014-03-19T22:05:56Z","headline":"Scoring Binge Hidin |
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
require 'spec_helper' | |
describe InstagramSyncFollowingWorker do | |
it 'should import or sync based on number of followers' do | |
InstagramAccount.stub(:import_or_sync) | |
VCR.use_cassette 'lib/instagram_user_follows' do | |
response = Instagram.user_follows | |
InstagramAccount.should_receive(:import_or_sync).exactly(response.count).times | |
InstagramSyncFollowingWorker.perform | |
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
require 'spec_helper' | |
describe Admin::TeamStreamsController do | |
before do | |
activate_authlogic | |
end | |
it_should_behave_like "an action that requires admin login" | |
context "instagram accounts" do |
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
#!/bin/bash | |
while true | |
do | |
for i in $(grep prod_br_db_slave ~/.ssh/config | sed 's/Host //') ; do sec=$(ssh $i 'mysql -e "show slave status \G" | grep Sec ' | sed "s/Seconds_Behind_Master://"); echo $i; if test $sec -gt 30 ; then echo 'sent email!'; echo $i "delayed" $sec | mail -s 'delay!' [email protected] ; fi & done | |
done |
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
trap(:SIGHUP) { reload } | |
@@stagger = 30 | |
def reload | |
path = "stagger.txt" | |
if File.exist?(path) | |
@@stagger = File.read(path).strip.to_i | |
puts "@@stagger reloaded with #{@@stagger}" | |
else | |
puts "no stagger.txt file found, keeping @@stagger at #{@@stagger}" |
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
1) | |
VCR::Errors::UnhandledHTTPRequestError in 'InstagramSyncFollowersCountWorker should sync followers count' | |
================================================================================ | |
An HTTP request has been made that VCR does not know how to handle: | |
GET https://api.instagram.com/v1/users/search.json?access_token=1059553397.20f3831.c5342af9457c4db788d9895db4444ef7&q=bleacherreport | |
There is currently no cassette in use. There are a few ways | |
you can configure VCR to handle this request: |
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 InstagramAccount < ActiveRecord::Base | |
belongs_to :tag | |
has_many :instagram_media, :dependent => :destroy | |
after_create :get_instagram_id | |
after_save :sync_following | |
class << self | |
def import_or_sync(obj) | |
account = InstagramAccount.find_by_instagram_id(obj["id"]) || InstagramAccount.new |