Skip to content

Instantly share code, notes, and snippets.

View tobias's full-sized avatar

Toby Crawley tobias

View GitHub Profile
(defun yank-to-gist ()
"yank from the top of the kill ring, create a gist from it, and insert the gist url at the point"
(interactive)
(save-excursion
(let ((buffer (current-buffer)))
(set-buffer (get-buffer-create "*yank-to-gist*"))
(yank)
(gist-region
(point-min)
(point-max)
# Convert XML response to defined Ruby Class
def xml_to_class(c, item)
obj = c.new
# Set default attributes
obj.id = item['id']
api = self
c.instance_eval do
define_method :client do
api
end
irb> client.keys.collect {|x| [x.id, x.actions_urls]}
[
[0] [
[0] "jimkey",
[1] {
"destroy" => "http://localhost:8080/deltacloud/api/keys/default"
}
],
[1] [
[0] "default",
[user]
email = [email protected]
name = Tobias Crawley
[push]
default = tracking
[github]
user = tobias
token = <redacted>
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
---
platforms:
- name: JBoss 3-Tier
platform_versions:
- version_number:
images:
- name: Backend - JBoss AS 6 M5 (w/TorqueBox 1.0.0.Beta22)
cloud_id: ami-68e51101
services:
- jboss_as
Artifact X v5
Artifact Y v3
Artifact Z v4
-------------
Artifact X v5
Artifact X v4
Artifact X v3
Artifact X v2
Artifact X v1
Artifact Y v3
def control(opts=nil, &block)
op = self
@control = Proc.new do
if opts and
opts[:with_capability] and
!driver.respond_to?(opts[:with_capability])
raise Deltacloud::BackendFeatureUnsupported.new('501', nil,
"#{opts[:with_capability]} not supported by backend", nil)
end
op.validate(params)
diff --git a/server/lib/deltacloud/backend_capability.rb b/server/lib/deltacloud/backend_capability.rb
new file mode 100644
index 0000000..bec8714
--- /dev/null
+++ b/server/lib/deltacloud/backend_capability.rb
@@ -0,0 +1,21 @@
+module Deltacloud::BackendCapability
+
+ class Failure < StandardError
+ attr_reader :capability
;;;###autoload
(defun gist-list ()
"Displays a list of all of the current user's gists in a new buffer."
(interactive)
(message "Retrieving list of your gists...")
(github-with-auth-info login token
(gist-request
(format "https://gist.github.com/api/v1/xml/gists/%s" login)
'gist-lists-retrieved-callback)))
Look! A gist!