Skip to content

Instantly share code, notes, and snippets.

View mamund's full-sized avatar

Mike Amundsen mamund

View GitHub Profile
@mamund
mamund / 00-http.html
Created October 13, 2010 15:58 — forked from mikekelly/http.html
forked version of mikekelly's very cool idea of a microformat for HTTP
<html>
<head>
<title>Example of HTTP microformat</title>
<meta name="author" content="mamund@yahoo.com" />
<style type="text/css">
dl.http
{
border: 1px solid black;
}
dl.http dt.request,
@mamund
mamund / gist:794419
Created January 25, 2011 02:39
JSON Link Standardization Examples
/* some suggestions on implementing hyperlinks in json */
// 5988-style (http://tools.ietf.org/html/rfc5988)
{ "link" :
{
"href" : "...",
"rel" : "...",
"hreflang" : "...",
"media" : "...",
"title" : "...",
@mamund
mamund / node-with-out-nesting.js
Created May 26, 2011 15:39
Writing NodeJS code w/o creating deep nesting.
var http = require('http');
http.createServer(function(req, res){sayHello(req,res)}).listen();
function sayHello(req,res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}
function sayGoodbye(req,res) {
@mamund
mamund / form-or-template.js
Created June 8, 2011 18:30
Is this a form or a template?
{
"queries" :
[
{
"href : "http://example.org/search",
"rel" : "search",
"prompt" : "Enter search string",
"data" :
[
{"name" : "search", "value" : ""}
@mamund
mamund / HypermediaOAuth.html
Created June 27, 2011 19:51
Hypermedia OAuth
<html>
<!-- Hypermedia OAuth -->
<head>
<meta name="profile" content="http://amundsen.com/hypermedia/profiles/oauth" />
<!--
*** NOTES ***
Based on Facebook dev notes on OAuth interactions : http://developers.facebook.com/docs/authentication/
This needs to be aligned w/ OAuth 2.0 docs : http://tools.ietf.org/html/draft-ietf-oauth-v2-16
*** state values ***
@mamund
mamund / gist:1635675
Created January 18, 2012 21:09
Cradle w/ credentials option
// for couch
var cradle = require('cradle');
var host = 'https://xxxx.cloudant.com';
var port = 443;
var credentials = {username: 'xxxx', password: 'xxxx' };
var local=false;
var db;
if(local===true) {
db = new(cradle.Connection)().database('xxxx');
}
@mamund
mamund / gist:1731836
Created February 3, 2012 19:15
WS-REST 2012 ABSTRACT
As the ecosystem of services on the Web continues to grow and evolve while, at the same time, the number and diversity of connected devices increases, challenges lie ahead for both providers and consumers of Web services. This paper focuses on two of these (sometimes opposing) challenges: immediate usability and long-term evolvability of the Web service itself.
Drawing from diverse sources including physical architecture, industrial design, the psychology of perception, and cross-cultural mono-myth, a new implementation paradigm is proposed to help software architects and developers meet these challenges; one that invites participants to shift their mental model from that of programming network devices to programming the network to which those devices are connected.
To accomplish this goal a “network language” is proposed; one that is based on shared understanding through network-oriented affordances instead of device-oriented APIs. Examples of this approach are given, possible outcomes examined, and area
@mamund
mamund / gist:1960447
Created March 2, 2012 19:07
PATCH document models
<!--
simple patch document
- flat document model
- always assume //{name} will be sufficient (need not be unique)
- always treat <value>...</value> as a replacement, even when it includes child elements
- no guarantees on processing order (adds might execute before delete, etc.)
- referring to the same name twice in a document is illegal
-->
<patch>
@mamund
mamund / conery-api-notes
Created March 3, 2012 03:22
Roby Conery API Challenge - Notes
This is step one: simple authentication and then consumption of basic data.
The client will be HTML, JS, and Mobile.
Logging In.
Customer comes to the app and logs in with email and password.
A token is returned by the server upon successful authentication and a
message is also received (like “thanks for logging in”).
Productions.
Joe User is logged in and wants to see what he can watch. He chooses to
@mamund
mamund / conery-api.html
Created March 3, 2012 03:25
Conery API Challenge - HTML API
<!-- see docs at bottom of file -->
<html>
<head>
<title>Sample Conery API</title>
</head>
<body>
<!-- assume a starting URI of the server's choosing -->