Created
April 14, 2014 13:36
-
-
Save mashiro/10648618 to your computer and use it in GitHub Desktop.
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 | |
# -*- encoding: utf-8 -*- | |
require 'bundler' | |
Bundler.require | |
def gist(filename, content, options = {}) | |
data = { | |
description: options[:description], | |
public: options.fetch(:public, false), | |
files: { | |
filename => { | |
content: content | |
} | |
} | |
} | |
conn = Faraday.new 'https://api.github.com' do |conn| | |
conn.request :json | |
conn.response :follow_redirects | |
conn.response :json, content_type: /\bjson$/ | |
conn.adapter :net_http | |
end | |
res = conn.post '/gists', data | |
puts res.body['html_url'] | |
end | |
begin | |
hoge | |
rescue => e | |
errors = [e.to_s] + e.backtrace.map { |s| "\t#{s}" } | |
gist 'error.txt', errors.join("\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My Pleasure to write you,
My name is Favor Williams,
My email address is
( [email protected])
Am interested to know
more about you,
Contact me for my
photo and other
important issue via,
[email protected]