Skip to content

Instantly share code, notes, and snippets.

View Xegyn's full-sized avatar

Carlo Stearns Xegyn

View GitHub Profile
@Xegyn
Xegyn / prepare-commit-msg
Last active December 8, 2015 19:46
Ruby git hook example prepare-commit-msg that parses pivotal story id and inserts it and a link in the commit message
#!/usr/bin/env ruby
# parse Pivotal ticket names out of branches named similar to
# xxxx-9999-xxxx-xxxx
# make sure the hook has permissions to execute after copying it over
message_file = ARGV[0]
original_message = File.read(message_file)
# Don't do anything if the commit already has a pivotal id i.e. in the case of --amend
unless original_message.match(/\[\d+\]/)
@Xegyn
Xegyn / prepare-commit-msg
Last active December 7, 2015 19:34
Ruby git hook example - prepare-commit-msg that parses jira ticket name and inserts it and a link in the commit message
#!/usr/bin/env ruby
# parse jira ticket names out of branches named similar to
# project-9999-xxxx-xxxx
# project names in the branch can be lowercase
# branches do not have to begin with the project-9999; xxxx-project-9999-xxxx-xxxx will also work
# make sure the hook has permissions to execute after copying it over
message_file = ARGV[0]wi
original_message = File.read(message_file)
@Xegyn
Xegyn / yql_oauth_sample.rb
Created September 25, 2012 23:55
Sample : YQL Query Using Omniauth, Omniauth-Oauth and Omniauth-Yahoo
require 'oauth'
require 'oauth/consumer'
require 'oauth/token'
require 'omniauth-yahoo'
key = 'Xdj0yJmk9VFV…..'
secret = '478787sha878978950e….'
options = {
:access_token_path => '/oauth/v2/get_token',
:authorize_path => '/oauth/v2/request_auth',