Skip to content

Instantly share code, notes, and snippets.

View timkelty's full-sized avatar

Tim Kelty timkelty

View GitHub Profile
def add_file(name, content)
load_files
@@files << {'name' => name, 'content' => content}
puts "#{name} added."
save_files
end
def send(private_gist)
load_files
<?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>
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
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."
def clear
@@files = []
save_files
end
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
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
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."
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."
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