Skip to content

Instantly share code, notes, and snippets.

@jacobo
Last active January 3, 2018 20:04
Show Gist options
  • Save jacobo/635c2c7ee6367c0d74443c3b714f51c2 to your computer and use it in GitHub Desktop.
Save jacobo/635c2c7ee6367c0d74443c3b714f51c2 to your computer and use it in GitHub Desktop.
gist_it = Proc.new do |content|
post_body = {
description: "gist",
public: false,
files: { :file1 => {content: content}}
}
resp = RestClient.post "https://api.github.com/gists", post_body.to_json, {content_type: :json, accept: :json}
JSON.parse(resp.body)["files"]["file1"]["raw_url"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment