Permalink
Browse files

allow randomized tweet hell based on repetative cron jobs (i.e. every…

… minute)
  • Loading branch information...
1 parent 400ea18 commit 005e9315ebf6c9a47e7ba2768e4ef95a59d6c678 @gleuch committed Oct 3, 2009
Showing with 14 additions and 3 deletions.
  1. +12 −2 retweet.rb
  2. +2 −1 settings.yml.default
View
14 retweet.rb
@@ -154,11 +154,21 @@ def launch_retweet_hell
# Launch retweet hell...
get '/run/*' do
@title = 'Launch Retweet Hell!'
+ launch = true
+
+ # Randomized retweet hell if running a cron job (recommended to use '*/1 * * * * curl -s http://example.com/run/----')
+ if configatron.randomize_hell
+ rand_hell = rand(30).round # Expected randomization every 30 minutes.
+ unless rand_hell == 1
+ @error = "Waiting patiently for a truely randomized hell."
+ launch = false
+ end
+ end
- if params[:splat].to_s == configatron.secret_launch_code.to_s
+ if launch && params[:splat].to_s == configatron.secret_launch_code.to_s
launch_retweet_hell
else
- @error = '<strong>WTF!?</strong> You ain\'t got access to this. Fuck off.'
+ @error ||= '<strong>WTF!?</strong> You ain\'t got access to this. Fuck off.'
haml :fail
end
end
View
3 settings.yml.default
@@ -1,6 +1,7 @@
development: &local
site_name: Retweet Game
+ randomize_hell: true
secret_launch_code: FFFFFAT
twitter_oauth_token: ENTER-YOUR-TOKEN-HERE
@@ -31,7 +32,7 @@ production:
db_type: sqlite
db_connection: sqlite3:///ROOT/rtgame_prod.db
- twitter_retweet_percent: 20
+ twitter_retweet_percent: 25
twitter_retweet_max: 500

0 comments on commit 005e931

Please sign in to comment.