Skip to content

Instantly share code, notes, and snippets.

@kenzo-tanaka
Last active March 10, 2021 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenzo-tanaka/f85997b6232ba9a9bfe0c9793a318b70 to your computer and use it in GitHub Desktop.
Save kenzo-tanaka/f85997b6232ba9a9bfe0c9793a318b70 to your computer and use it in GitHub Desktop.
require 'active_support/time'
require 'active_support/core_ext'
output_txt = ""
start_of_month = Time.now.beginning_of_month.to_date.strftime("%Y-%m-%d")
end_of_month = Time.now.end_of_month.to_date.strftime("%Y-%m-%d")
date_range = (start_of_month..end_of_month)
date_range.each do |d|
text = <<~EOS
## #{d}
- [ ] TODO1
- [ ] TODO2
- [ ] TODO3
EOS
output_txt << text
end
# File output
year = Date.today.year
month = Date.today.strftime("%m") # 03,04
File.open("#{year}/#{month}/README.md", "w") { |f| f.write(output_txt) }
@kenzo-tanaka
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment