Created
October 12, 2015 12:59
-
-
Save asgrim/ddcdd4e5873cac9b87b3 to your computer and use it in GitHub Desktop.
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
<?php | |
$hellos = ['hi', 'hey']; | |
$separators = [ | |
' ', | |
', ', | |
' - ', | |
'... ', | |
'.. ', | |
]; | |
$questions = [ | |
'will you be at', | |
'will you be coming to', | |
'will you make', | |
'can you make', | |
'can you come to', | |
'can you make it to', | |
'do you fancy coming to', | |
'do you think you\'ll be at', | |
'reckon you\'ll be down for', | |
'reckon you\'ll be at', | |
]; | |
$eventNames = [ | |
'PHP Hampshire', | |
'PHP Hants', | |
]; | |
$dates = [ | |
'on Weds?', | |
'on Weds? :)', | |
// 'tomorrow?', | |
// 'tomorrow? :)', | |
]; | |
$link = 'phphants.co.uk/meetups'; | |
$receipientsRaw = " | |
@asgrim James | |
@phphants PHPHants | |
"; | |
$receipients = explode("\n", $receipientsRaw); | |
foreach ($receipients as $receipient) { | |
if (empty($receipient)) continue; | |
list($twitter, $name) = explode("\t", $receipient); | |
$tweet = $twitter . ' '; | |
$tweet .= $hellos[mt_rand(0, count($hellos)-1)] . ' '; | |
$tweet .= $name; | |
$tweet .= $separators[mt_rand(0, count($separators)-1)]; | |
$tweet .= $questions[mt_rand(0, count($questions)-1)] . ' '; | |
$tweet .= $eventNames[mt_rand(0, count($eventNames)-1)] . ' '; | |
$tweet .= $dates[mt_rand(0, count($dates)-1)] . ' '; | |
$tweet .= $link; | |
if (strlen($tweet) > 140) { | |
die("ERROR: Tweet to $twitter was > 140 characters.\n"); | |
} | |
echo $tweet . "\n"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment