Skip to content

Instantly share code, notes, and snippets.

@k2052
Created April 3, 2013 00:08
Show Gist options
  • Save k2052/5297361 to your computer and use it in GitHub Desktop.
Save k2052/5297361 to your computer and use it in GitHub Desktop.
Creates a post from a passed in markdown file with meta data
#!/usr/bin/env ruby
require 'metadown'
require 'rest_client'
file_name = ARGV[0]
url = ARGV[1]
url ||= 'http://words.k2052.me/jots'
source = File.read(file_name)
data = Metadown.render(source)
result = RestClient.post(url,
{
:jot => {:note => data.output}.merge!(data.metadata),
:access_key => ENV['WORDS_K2052_ME_ACCESS_KEY']
},
{:accept => 'application/json'}
)
puts "Successful? #{result.code}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment