Skip to content

Instantly share code, notes, and snippets.

View mamund's full-sized avatar

Mike Amundsen mamund

View GitHub Profile
@mamund
mamund / conery-api.js
Created March 3, 2012 03:26
Conery API Challenge - Collection+JSON API
/* Rob Conery API Sample */
// see docs at bottom of file
// based on Collection+JSON media type
// http://www.amundsen.com/media-types/collection/
// login template
// use this data to execute HTTP BASIC over HTTPS
template : [
@mamund
mamund / conery-api.xml
Created March 3, 2012 03:27
Conery API Challenge - XML API
<!-- Conery API in XML -->
<!-- see docs at bottom of file -->
<!-- assume a starting uRI supplied by the host server -->
<conery>
<login href="...">
<email>...</email>
<password>...</password>
@mamund
mamund / paging-affordance.xml
Created March 6, 2012 18:52
Sample Paging Affordance
<PageInformation>
<CurrentPage href="...">2</CurrentPage>
<FirstPage href="..">1</NextPage>
<PreviousPage href="..">1</LastPage>
<NextPage href="..">5</NextPage>
<LastPage href="..">44</LastPage>
<TotalItems>1085</TotalItems>
<PageSize>25</PageSize>
<SelectPage href="...?page={@pagenumber}" />
<SetPageSize href="..."><size value="" /></SetPageSize>
@mamund
mamund / gist:2561720
Created April 30, 2012 19:18
supporting inline collections for collection+json
{ "collection" :
 {
   "version" : "1.0",
   "href" : "http://example.org/posts/",
   "items" : [
     {
       "href" : "http://example.org/posts/1",
       "data" : [
         {"name" : "full-name", "value" : "J. Doe", "prompt" : "Full Name"},
@mamund
mamund / h-aspects.html
Created June 11, 2012 02:56
any advice on color/font tuning?
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
table.aspects {
margin: 3em;
padding: 1em;
@mamund
mamund / ajax-call-with-compression.js
Created August 27, 2012 17:26
XmlHttpRequest w/ compression support
// typical generic request routine (handles GET and POST)
function makeRequest(href, next, body, contentType) {
var ajax;
ajax=new XMLHttpRequest();
if(ajax) {
ajax.onreadystatechange = next();
if(body) {
@mamund
mamund / sales.csv
Created October 16, 2012 15:25
Sample representations of the same data
north south east west
300 200 350 150
@mamund
mamund / ordersAndLines-cj.js
Last active December 15, 2015 14:08
heterogeneous collection in a single Cj response
{
"collection" : {
"href" : "...",
"items" : [
{
"href" : "/orders/1",
"data" : [...],
"links" : [
{"rel" : "type", "href" : "http://example.org/rels#order"}
]
<!--
Date: 2013-05-06
Author: @mamund
Note: Some ways to determine when a URI has an associated resolver and whether it SHOULD be resolvable.
-->
<root>
<scheme>
<!-- the scheme portion of the URI can indicate which (if any) resolver should be used -->
<example>
@mamund
mamund / object-ext.js
Created June 14, 2013 14:17
Adding "object" support to collection+json
// sample links array
{
"collection" :
{
"version" : "1.0",
"href" : URI,
"items" :
[
{
"href" : URI,