Skip to content

Instantly share code, notes, and snippets.

@anson0370
Created May 17, 2013 16:33
Show Gist options
  • Save anson0370/5600297 to your computer and use it in GitHub Desktop.
Save anson0370/5600297 to your computer and use it in GitHub Desktop.
draw char by commit
require 'date'
author = "Anson"
email = "anson0370@gmail.com"
date = Date.new(2012, 7, 30)
a = %w{
. . . . . .
. o o o . .
o . . . o .
o o o o o .
o . . . o .
o . . . o .
. . . . . .
}
n = %w{
. . . . . .
o . . . o .
o o . . o .
o . o . o .
o . . o o .
o . . . o .
. . . . . .
}
s = %w{
. . . . . .
. o o o o .
o . . . . .
. o o o . .
. . . . o .
o o o o . .
. . . . . .
}
o = %w{
. . . . . .
. o o o . .
o . . . o .
o . . . o .
o . . . o .
. o o o . .
. . . . . .
}
matrix = []
[a, n, s, o, n].each{|c| matrix += c.each_slice(c.length / 7).to_a.transpose.flatten}
%x[git init]
matrix.each do |day|
if day == "o"
%x[git commit --allow-empty --author="#{author} <#{email}>" --date="#{date.to_time}" -m"#{date.to_time} - by: #{author}"]
end
date = date.next
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment