Created
February 13, 2014 11:49
-
-
Save pch/8973757 to your computer and use it in GitHub Desktop.
Tricking myself into writing.
This file contains 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 characters
#!/usr/bin/env ruby | |
# | |
# I use the following script to trick myself into writing every day. | |
# | |
# All it does is create a directory for the current month (YYYY/MM), | |
# create an empty markdown file for today and annoy the hell out of | |
# me until I put something in that file. | |
# | |
# I run the script with GeekTool every 30 minutes: | |
# http://projects.tynsoe.org/en/geektool/ | |
# | |
# The directory structure is: | |
# | |
# journal | |
# 2014 | |
# 01 | |
# 02 | |
# 01.md | |
# 02.md | |
# 03.md | |
# bin | |
# discipline | |
# | |
require 'date' | |
require 'fileutils' | |
ROOT_DIR = ::File.expand_path('../../', __FILE__) | |
date = Date.today | |
month_dir = ROOT_DIR + '/' + date.strftime('%Y/%m') | |
filename = month_dir + '/' + date.strftime('%d') + '.md' | |
unless File.exists?(filename) | |
FileUtils.mkdir_p(month_dir) | |
FileUtils.touch(filename) | |
end | |
if File.zero?(filename) | |
`osascript -e 'display notification "You haven’t written anything today! 😢" with title "Write"'` | |
puts 'Your journal is empty 😢' | |
end |
Author
pch
commented
Feb 13, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment