This file contains 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
def add_file(name, content) | |
load_files | |
@@files << {'name' => name, 'content' => content} | |
puts "#{name} added." | |
save_files | |
end | |
def send(private_gist) | |
load_files |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>beforeRunningCommand</key> | |
<string>nop</string> | |
<key>command</key> | |
<string>RUBYLIB="$TM_BUNDLE_SUPPORT/lib:$RUBYLIB" | |
"${TM_RUBY:=ruby}" -- "${TM_BUNDLE_SUPPORT}/bin/show_network_in_github.rb" | |
</string> |
This file contains 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
d happened. No gist created." | |
when Net::HTTPFound | |
url = copy req['Location'] | |
# print "Created gist at #{url}. URL copied to clipboard." | |
print gistname | |
end | |
clear | |
end |
This file contains 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
end | |
def send(private_gist) | |
load_files | |
url = URI.parse('http://gist.github.com/api/v1/' + get_extension + 'xml/new') | |
req = Net::HTTP.post_form(url, data(private_gist)) | |
case req | |
when Net::HTTPBadRequest | |
print "Ewww, not your fault, but something bad happened. No gist created." |
This file contains 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
def clear | |
@@files = [] | |
save_files | |
end |
This file contains 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
def data(private_gist) | |
params = {} | |
@@files.each_with_index do |file, i| | |
params.merge!({ | |
"file_ext[gistfile#{i+1}]" => '', | |
"file_name[gistfile#{i+1}]" => file['name'], | |
"file_contents[gistfile#{i+1}]" => file['content'] | |
}) | |
end |
This file contains 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
case req | |
when Net::HTTPBadRequest | |
print "Ewww, not your fault, but something bad happened. No gist created." | |
when Net::HTTPFound | |
url = copy req['Location'] | |
print "Created gist at #{url}. URL copied to clipboard." | |
end | |
clear | |
end |
This file contains 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
def send(private_gist) | |
load_files | |
url = URI.parse('http://gist.github.com/api/v1/' + get_extension + '/new') | |
req = Net::HTTP.post_form(url, data(private_gist)) | |
case req | |
when Net::HTTPBadRequest | |
print "Ewww, not your fault, but something bad happened. No gist created." | |
when Net::HTTPFound | |
url = copy req['Location'] | |
print "Created gist at #{url}. URL copied to clipboard." |
This file contains 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
def send(private_gist) | |
load_files | |
url = URI.parse('http://gist.github.com/api/v1/' + get_extension + '/new') | |
req = Net::HTTP.post_form(url, data(private_gist)) | |
puts req.inspect | |
case req | |
when Net::HTTPBadRequest | |
print "Ewww, not your fault, but something bad happened. No gist created." |
This file contains 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
def send(private_gist) | |
load_files | |
url = URI.parse('http://gist.github.com/api/v1/xml/new') | |
req = Net::HTTP.post_form(url, data(private_gist)) | |
puts req.inspect | |
case req | |
when Net::HTTPBadRequest | |
print "Ewww, not your fault, but something bad happened. No gist created." | |
when Net::HTTPFound |