This file contains hidden or 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
require 'rubygems' | |
require 'git' | |
module Git | |
class Lib | |
# finds a tag with the same hash as the specified branch's head (if any) | |
def tag_for_head(branch) | |
tag = nil | |
head_hash = command('show-ref', ['--hash', "#{branch}"]) | |
command('show-ref', ['--tags']).each do |r| |
This file contains hidden or 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
def extended_encode(data_arr, max_value) | |
# Douglas F Shearer 2007 | |
# http://douglasfshearer.com/blog/ruby-google-charts-api-data-encoding | |
characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-.'.split(//) | |
data = '' | |
data_arr.each do |value| | |
if value.is_a?(Integer) && value >= 0 | |
new_value = ((4095 * value.to_f / max_value.to_f).to_i) | |
sixtyfours = new_value/64 | |
units = new_value%64 |
NewerOlder