Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block jonm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jonm / xhtml_api_example.html
Created Nov 25, 2010
Sample document using XHTML for hypermedia APIs.
View xhtml_api_example.html
<!-- quick demo of XHTML API style -->
<div class="dvr">
<p>This div (and all it contains), represents a DVR set-top box. Some parts, like this text, may be
ignored by programmatic clients. A client can recognize it by its @class attribute. The general
convention here is one of inclusion rather than position, and clients make a lot of use of the
"//" (descendent) XPath operator rather than the "/" (child) operator.</p>
<!-- by the next form's @class I can recognize this is what I use to assign a friendly name.
jonm / shallow-vs-deep.html
Created Dec 8, 2011
Shallow vs. deep representations in XHTML Hypermedia APIs
View shallow-vs-deep.html
<!-- the following div is a sample representation of a 'car' domain object; it can be identified as
such by the presence of 'car' in its @class. In this case, the car has two attributes, a make
and a model, and both are included right here. This is what I call a deep/complete/concrete
representation. -->
<div id="car123" class="car">
<span class="make">Ford</span>
<span class="model">Mustang</span>
jonm / json-nowhitespace.txt
Created Jul 10, 2012
JSON example with whitespace removed
View json-nowhitespace.txt
jonm / HTML-nowhitespace.txt
Created Jul 10, 2012
HTML version without whitespace
View HTML-nowhitespace.txt
<html><body><ol class="contacts"><li><span class="firstname">Jon</span><span class="lastname">Moore</span></li><li><span class="firstname">Homer</span><span class="lastname">Simpson</span></li></ol></body></html>
jonm / gist:3080485
Created Jul 10, 2012
Sample Twitter JSON response
View gist:3080485
[{"created_at":"Tue Jul 10 01:42:10 +0000 2012","id":222505965281488898,"id_str":"222505965281488898","text":"We will be performing #D3 maintenance Tuesday, July 10 beginning at 5am PDT: http:\/\/\/2jr91xDu","source":"\u003ca href=\"http:\/\/\" rel=\"nofollow\"\u003eRadian6 \u003c\/a\u003e","truncated":false,"in_reply_to_status_id":null,"in_reply_to_status_id_str":null,"in_reply_to_user_id":null,"in_reply_to_user_id_str":null,"in_reply_to_screen_name":null,"user":{"id":174307074,"id_str":"174307074","name":"BlizzardCS","screen_name":"BlizzardCS","location":"Irvine CA and Austin TX","description":"Blizzard Entertainment North America Customer Support","url":"http:\/\/\/support\/","protected":false,"followers_count":220559,"friends_count":32,"listed_count":2008,"created_at":"Tue Aug 03 16:26:52 +0000 2010","favourites_count":0,"utc_offset":-28800,"time_zone":"Pacific Time (US & Canada)","geo_enabled":true,"verified":false,"statuses_count":12121,"lang":"en","contributors_enabled":f
jonm / gist:3080489
Created Jul 10, 2012
Twitter sample XML response
View gist:3080489
<?xml version="1.0" encoding="UTF-8"?>
<statuses type="array">
<created_at>Tue Jul 10 01:42:10 +0000 2012</created_at>
<text>We will be performing #D3 maintenance Tuesday, July 10 beginning at 5am PDT:</text>
<source>&lt;a href=&quot;; rel=&quot;nofollow&quot;&gt;Radian6 &lt;/a&gt;</source>
jonm / gist:3081067
Created Jul 10, 2012
HTML version of Twitter
View gist:3081067
<ol class="statuses">
<li class="status" id="222505965281488898" data-retweet-count="3">
<date class="created_at">Tue Jul 10 01:42:10 +0000 2012</date>
<p class="text">We will be performing #D3 maintenance Tuesday, July 10 beginning at 5am PDT:</p>
<span class="source">&lt;a href="" rel="nofollow"&gt;Radian6 &lt;/a&gt;</span>
<div class="user profile-use-background-image geo-enabled following" id="174307074" data-followers-count="220560"
data-profile-background-color="C0DEED" data-profile-text-color="333333"
data-profile-link-color="0084B4" data-profile-sidebar-fill-color="C0DEED"
jonm / gist:3122100
Created Jul 16, 2012
Retrieve and edit a text/uri-list
View gist:3122100
GET /favorites HTTP/1.1
User-Agent: curl/7.16.4 (i386-apple-darwin9.0) libcurl/7.16.4 OpenSSL/0.9.7l zlib/1.2.3
Accept: text/uri-list;q=1.0, */*;q=0.9
HTTP/1.1 200 OK
Date: Mon, 16 Jul 2012 10:38:12 GMT
Content-Type: text/uri-list; charset=utf-8
jonm / gist:3548446
Created Aug 31, 2012
Sample list represented as application/atom+xml
View gist:3548446
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="">
<title>Example Atom List</title>
<link rel="self" href=""/>
<!-- note that we can provide hints of other list media types
supported by this server by providing links with the
link relation "alternate" and filling in the @type
attribute on them -->
<link rel="alternate" href="" type="text/uri-list"/>
jonm / gist:3548629
Created Aug 31, 2012
Sample list represented as text/html
View gist:3548629
<!-- HTML5 microdata would also be possible here, to give
more semantic structure, but the below is essentially
an HTML version of text/uri-list -->
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
You can’t perform that action at this time.