Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bunchc/e02b932fecdde3a507698e3713c02a36 to your computer and use it in GitHub Desktop.
Save bunchc/e02b932fecdde3a507698e3713c02a36 to your computer and use it in GitHub Desktop.
Case-Notes Template / Usage

Customer: Orangutan-Roasters Project: Burundai Tasting Author: Cody Bunch Date: 2017-04-17 categories:

Orangutan-Roasters

Some background here

Burundai Tasting

Some background here

Notes:

require 'fileutils'
task :note do
customer = ENV['customer'] || 'internal'
project = ENV['project'] || 'stuff'
author = ENV['author'] || 'Cody Bunch'
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d')
filename = File.join('.', "#{Time.now.strftime('%Y-%m-%d')}-#{customer.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}-#{project.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.md")
open(filename, 'w') do |post|
post.puts "Customer: #{customer}"
post.puts "Project: #{project}"
post.puts "Author: #{author}"
post.puts "Date: #{Time.now.strftime('%Y-%m-%d')}"
post.puts "categories: "
post.puts "---"
post.puts " "
post.puts "\# #{customer}"
post.puts "\nSome background here\n"
post.puts "\# #{project}"
post.puts "\nSome background here\n"
post.puts "\# Notes:"
end
end
bunchc ~/projects/case-notes
$ cat Rakefile
require 'fileutils'
task :note do
customer = ENV['customer'] || ''
project = ENV['project'] || 'stuff'
author = ENV['author'] || ''
date = (ENV['date'] ? Time.parse(ENV['date']) : Time.now).strftime('%Y-%m-%d')
filename = File.join('.', "#{Time.now.strftime('%Y-%m-%d')}-#{customer.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}-#{project.strip.gsub(' ', '-').gsub(/[^\w-]/, '')}.md")
open(filename, 'w') do |post|
post.puts "Customer: #{customer}"
post.puts "Project: #{project}"
post.puts "Author: #{author}"
post.puts "Date: #{Time.now.strftime('%Y-%m-%d')}"
post.puts "categories: "
post.puts "---"
post.puts " "
post.puts "\# #{customer}"
post.puts "\nSome background here\n"
post.puts "\# #{project}"
post.puts "\nSome background here\n"
post.puts "\# Notes:"
end
end
bunchc ~/projects/case-notes
$ rake note customer=Orangutan-Roasters project="Burundai Tasting"
bunchc ~/projects/case-notes
$ subl 2017-04-17-Orangutan-Roasters-Burundai-Tasting.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment