Last active
          October 13, 2015 15:37 
        
      - 
      
 - 
        
Save drnikko/4217482 to your computer and use it in GitHub Desktop.  
    Skitch replacement, step 2
  
        
  
    
      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 characters
    
  
  
    
  | #!/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