Permalink
Browse files

refresh at startup

  • Loading branch information...
1 parent 078e98e commit 23be700d7071fca24f7252ad8cf4e0506fb9bd46 @mattb committed Jul 22, 2011
Showing with 8 additions and 2 deletions.
  1. +3 −1 othereplies/app.rb
  2. +1 −1 othereplies/user.rb
  3. +4 −0 othereplies/views/twitter.erb
View
4 othereplies/app.rb
@@ -21,11 +21,13 @@ class OtherApp < Sinatra::Base
end
get '/debug' do
- @users = User.all.map { |u| User.new(u) }.sort_by { |u| u.screen_name.value }
+ @users = User.all.map { |u| User.new(u) }.sort_by { |u| u.screen_name.value.downcase }
erb :debug
end
get '/twitter/:token' do
+ Redis::Objects.redis.publish("usercommands", { :id => params[:token], :command => 'checkin' }.to_json)
+
@token = params[:token]
@juggernaut_port = 8081
uri = URI.parse(request.url)
View
2 othereplies/user.rb
@@ -126,6 +126,6 @@ def filter_timeline(tweets)
end
def recent_tweets(&block)
- self.timeline.range(0,10).each { |json| block.call(self,Hashie::Mash.new(JSON.parse(json))) }
+ self.timeline.revrange(0,10).reverse.each { |json| block.call(self,Hashie::Mash.new(JSON.parse(json))) }
end
end
View
4 othereplies/views/twitter.erb
@@ -54,6 +54,10 @@
setInterval(update_timestamps, 60*1000);
setTimeout(function() {
+ $.get('/twitter/<%= @token %>/refresh');
+ },1000);
+
+ setTimeout(function() {
$('#intro').hide(750);
},10000);
});

0 comments on commit 23be700

Please sign in to comment.