Created
November 14, 2012 04:54
-
-
Save ox/4070330 to your computer and use it in GitHub Desktop.
Revisions
-
ox revised this gist
Nov 14, 2012 . 1 changed file with 4 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,11 +10,9 @@ days_in_month = (Date.new(time.year, 12, 31) << (12-time.month)).day commits_from_this_month = `git log --format="%aD" --since=1.month`.split("\n") days = commits_from_this_month.map { |n| Time.parse(n) } .take_while { |n| n.mon == time.mon } .map { |n| n.day } print " " * sday.wday (1..days_in_month).each do |n| @@ -25,7 +23,7 @@ puts "\n\n" streak = 0 for n in (0..time.day) do if days.include?(time.day - n) streak = streak + 1 else -
ox revised this gist
Nov 14, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ puts "\n\n" streak = 0 for n in (0..(days_in_month-time.day)) do if days.include?(time.day - n) streak = streak + 1 else -
ox revised this gist
Nov 14, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,8 +25,8 @@ puts "\n\n" streak = 0 for n in (0..(days_in_month-n)) do if days.include?(time.day - n) streak = streak + 1 else break -
ox revised this gist
Nov 14, 2012 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,3 +23,14 @@ end puts "\n\n" streak = 0 for n in (1..days_in_month) do if days.include?(days_in_month - n) streak = streak + 1 else break end end puts "#{streak} day streak!" if streak > 0 -
ox created this gist
Nov 14, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ require 'date' require 'time' require 'colored' time = Date.today puts time.strftime("%B %Y").center(20) puts "Su Mo Tu We Th Fr Sa" sday = Date.new(time.year, time.month, 1) days_in_month = (Date.new(time.year, 12, 31) << (12-time.month)).day commits_from_this_month = `git log --format="%aD" --since=1.month`.split("\n") dates = commits_from_this_month.map { |n| Time.parse(n) }.take_while do |n| n.month == time.month and n.year == time.year end days = dates.map { |n| n.day } print " " * sday.wday (1..days_in_month).each do |n| print n.to_s.rjust(2).send(days.include?(n) ? :green : :red) (sday = sday + 1).wday == 0 ? print("\n") : print(" ") end puts "\n\n"