Skip to content

Instantly share code, notes, and snippets.

@andrei512
Last active January 3, 2016 19:59
Show Gist options
  • Save andrei512/8512447 to your computer and use it in GitHub Desktop.
Save andrei512/8512447 to your computer and use it in GitHub Desktop.
class Array
def random_element
self[Random.rand(length)]
end
end
namespace :events do
desc "Do stuff every hour"
task every_hour: :environment do
habit_triggers = [
"How about some tea?",
"Let's get active!",
"I wonder what's new on the internet?"
]
random_habit_trigger = habit_triggers.random_element
`say -v Vicki "#{random_habit_trigger}"`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment