Skip to content

Instantly share code, notes, and snippets.

@RickCarlino
Created November 19, 2022 18:04
Show Gist options
  • Save RickCarlino/9536bff8fcdae67f5ebfd9e926a7dc10 to your computer and use it in GitHub Desktop.
Save RickCarlino/9536bff8fcdae67f5ebfd9e926a7dc10 to your computer and use it in GitHub Desktop.
Daylio Journal Formatter ingests Daylio CSV export and produces Markdown / Gemtext
require "csv"
require "date"
output = []
File.open("raw.csv").each_line do |input_row|
begin
CSV.parse(input_row) do |(date, time, entry)|
if entry && date != "full_date"
a = "#{date} #{time}"
output.push([DateTime.parse(a), entry])
end
end
end
end
output
.group_by{|(d,e)| d.jd}
.to_a
.sort{|(d,e)| d}
.map do |(date, entries)|
header = entries.first.first.strftime("# %m/%d/%Y").chomp
body = entries.sort { |(d,t)| d }.map { |(d,t)| puts d.strftime("\n%H:%M: #{t}").chomp }
puts "\n" + header + body.join()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment