Skip to content

Instantly share code, notes, and snippets.

View mikekelly's full-sized avatar

Mike Kelly mikekelly

View GitHub Profile
<resource href="/orders">
<link rel="next" href="/orders?page=2" />
<link rel="search" href="/orders?id={order_id}" />
<resource rel="order" href="/orders/123">
<link rel="customer" href="/customer/bob" title="Bob Jones <bob@jones.com>" />
<resource rel="basket" href="/orders/123/basket">
<item>
<sku>ABC123</sku>
<quantity>2</quantity>
<price>9.50</price>
{
"_links" : {
"search" : { "href" : "/todo-list/search;{searchterm}" },
"description" : { "href" : "/todo-list/description" }
},
"_embedded" : {
"owner" : {
"_links" : {
"self" : { "href" : "http://range14sux.com/mike"},
"friend" : { "href": "http://mamund.com/" }
<html>
<head>
<title>Example of HTTP microformat</title>
</head>
<body>
<div class="http">
<div class="request">
<div class="line">
<span class="method">POST</span> <span class="resource">/foo/bar</span> <span class="http-version">HTTP/1.1</span>
</div>
@mikekelly
mikekelly / gist:669660
Created November 9, 2010 19:33
invoice.xml
# GET /invoice/1203897
<resource rel="self" href="/invoice/1203897">
<link rel="client" href="http://evilinc.com" />
<resource rel="line-item" href="/invoice/1203897/line-item/1">
<resource rel="item" href="/invetory/9821732">
<sku>WHMK5662</sku>
<description>Interesting Widget</description>
</resource>
<quantity>5</quantity>
@mikekelly
mikekelly / gist:669662
Created November 9, 2010 19:35
invoice.hal.xml
#GET /invoice/1203897
<resource rel="self" href="/invoice/1203897">
<link rel="client" href="http://evilinc.com" />
<resource rel="line-item" href="/invoice/1203897/line-item/1">
<resource rel="item" href="/invetory/9821732">
<sku>WHMK5662</sku>
<description>Interesting Widget</description>
</resource>
<quantity>5</quantity>
@mikekelly
mikekelly / halv3.xml
Created January 17, 2011 14:50
Example use of hal
<resource rel="self" href="/my_collection">
<link rel="next" href="/another_collection" />
<link rel="search" templated="true" href="/my_collection/search={searchterm}" />
<control activity="createItem" target="/my_collection" template="/my_collection/new" method="PUT" content-type="application/vnd.ericjbowman+xml"/>
<resource rel="info" href="/my_collection/info" etag="ZOMGSCIENCE1337" cache-control="public, max-age=600">
<items>12</items>
<foo>bar</foo>
</resource>
</resource>
var x = foo.bar["func"](param);
$(document).ready(function () {
$('#gco_slider_01').cycle({
fx: 'scrollHorz',
speed: 450,
timeout: 0,
after: function (curr, next, opts) {
var index = opts.currSlide;
$('#gco_slider_01_prev')[index == 0 ? 'hide' : 'show']();
$('#gco_slider_01_next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
@mikekelly
mikekelly / 0_README.txt
Created March 29, 2011 23:19
a sketch of application/halo+json & application/halo+xml
I've added a control element with these properties/attributes:
method ; method to use for generated request e.g. POST/PUT/DELETE
content-type ; (optional) content-type of the request body generated by the template (defaults to application/hal+xml)
schema ; contains schema for data submitted to template
template ; (optional) A string or object representing the template or form for the request.
template-href ; (optional) Contains a URI which links to a resource where the template or form can be fetched.
template-type ; (optional) URI used to identify the template format in use (defaults to mustache).
@mikekelly
mikekelly / example.lisp
Created April 21, 2011 11:12
Example resource definition
(defresource "example"
(GET (lambda (req)
'(200
(:content-type "text/plain")
("This is the example resource"))))
(POST (lambda (req)
'(200
(:content-type "text/plain")
("Thanks for posting something")))))