Skip to content

Instantly share code, notes, and snippets.

@zamuro
Last active November 10, 2019 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamuro/1bb129f9141dedb0f4c4a0091f291edf to your computer and use it in GitHub Desktop.
Save zamuro/1bb129f9141dedb0f4c4a0091f291edf to your computer and use it in GitHub Desktop.
Use chucknorris.io API to get random git commit messages
#!/usr/bin/ruby
## PLACE THIS ON $HOME/bin (or wherever your $PATH executables are) and set appropiate permissions
require 'net/http'
require 'json'
def chuck
url = URI('https://api.chucknorris.io/jokes/random')
request = Net::HTTP.get(url)
response = JSON.parse(request)
response['value']
end
system('git add .')
system("git commit -m '#{chuck}'")
system('git push origin $1') # being $1 a parameter for shell command. e.g.: chuckommit master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment