Skip to content

Instantly share code, notes, and snippets.

# (c) 2012 Luca Guidi (lucaguidi.com) – Released under MIT License
#
# It prompts:
# *[master][~/Developer/epts]% rb:1.9.3-p0
#
# Meaning:
# - The asterisk is for mark uncommitted git changes
# - In the square brackets are respectively: for the current git branch
# and for the current directory
# - The percent is the prompt
#!/usr/bin/env ruby
unless ARGV[0]
puts 'Usage: newpost "the post title"'
exit(-1)
end
date_prefix = Time.now.strftime("%Y-%m-%d")
postname = ARGV[0].strip.downcase.gsub(/ /, '-')
post = "/Users/al3x/src/al3x.github.com/_posts/#{date_prefix}-#{postname}.textile"