Skip to content

Instantly share code, notes, and snippets.

@drnikko
Last active October 13, 2015 15:37
Show Gist options
  • Save drnikko/4217482 to your computer and use it in GitHub Desktop.
Save drnikko/4217482 to your computer and use it in GitHub Desktop.
Skitch replacement, step 2
#!/usr/bin/env ruby
#JSON Parsing example
require "rubygems"
require "json"
# i don't like this at all....
photopath = "#{ARGV[0]}"
# running from within the repository
thecommand ="./openphoto -p -X POST -h YOUR_OPENPHOTO_HOST -e /photo/upload.json -F 'photo=@" + photopath + "' -F 'tags=REPLACEME,WITHTAGS' "
json = `#{thecommand}`
parsed = JSON.parse(json)
thepath = parsed["result"]["pathBase"]
# on a mac, anyway
exec "echo #{thepath} | pbcopy"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment