-
-
Save jrk/106869 to your computer and use it in GitHub Desktop.
Revisions
-
jrk revised this gist
May 5, 2009 . 1 changed file with 8 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,26 +1,29 @@ #!/usr/bin/env ruby require Dir unless ARGV[0] puts 'Usage: newpost "the post title"' exit(-1) end blog_root = "/Users/jrk/proj/blog" date_prefix = Time.now.strftime("%Y-%m-%d") postname = ARGV[0].strip.downcase.gsub(/ /, '-') post = "#{blog_root}/_posts/#{date_prefix}-#{postname}.md" header = <<-END --- layout: post title: "#{ARGV[0]}" --- END Dir.chdir(blog_root) File.open(post, 'w') do |f| f << header end system("mate", "-w", post) system("git", "add", post) -
al3x revised this gist
Apr 23, 2009 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,13 @@ #!/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" header = <<-END --- @@ -18,9 +19,8 @@ END File.open(post, 'w') do |f| f << header end system("mate", "-a", post) -
al3x created this gist
Apr 22, 2009 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ #!/usr/bin/env ruby unless ARGV[0] puts "Usage: newpost post-title" exit(-1) end date_prefix = Time.now.strftime("%Y-%m-%d") postname = ARGV[0].strip.downcase.gsub(/ /, '-') header = <<-END --- layout: post title: "#{ARGV[0]}" --- h1. {{ page.title }} END f = File.open("/Users/al3x/src/al3x.github.com/_posts/#{date_prefix}-#{postname}.textile", 'w+') f << header f.close system("#{ENV['VISUAL']} #{f.path}") exit(0)