Skip to content

Instantly share code, notes, and snippets.

@samvincent
Created November 16, 2009 16:51
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save samvincent/236126 to your computer and use it in GitHub Desktop.
Format my basecamp time-report.csv files so I can paste easily in freshbooks
#!/usr/bin/env ruby
require 'csv'
require 'date'
CSV::Reader.parse(File.open(ARGV[0])) do |row|
date = row[0].match(/^\d{4}-\d{2}-\d{2}/) ? Date.strptime(row[0], "%Y-%m-%d") : row[0]
hours = row[2]
memo = "#{row[3]} #{row[4]}"
puts "#{date} | #{hours} | #{memo}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment