Skip to content

Instantly share code, notes, and snippets.

View mikekelly's full-sized avatar

Mike Kelly mikekelly

View GitHub Profile
@mikekelly
mikekelly / min_hal.json
Created June 15, 2011 16:41
minimum valid hal representation
{ "_links": { "self": { "href": "http://example.com/" } } }
<resource href="/">
<motd>Welcome. Today's special offer: by 600 flat whites and get an extra free.</motd>
<link rel="rb:orderList" href="/order-list" />
</resource>
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
<resource href="documents/123/versions" xmlns="http://hal.schema.huddle.net/2011/02/">
<link rel="parent" href="documents/123" />
<resource rel="documentVersion" title="a new title" href="documents/123/versions#543">
<link rel="content" href="..." />
<link rel="thumb" href="..." />
<resource title="Barry Potter" rel="updated-by actor" href="...">
<link rel="avatar" href="..." type="image/jpg" />
<link rel="alternate" href="..." type="text/html" />
{
"1":{
"key":{
"gray":"No service on Saturday"
},
"out":{
"stops":[
"Liberation Station",
"La Mare Slip",
"Le Bourg",
@mikekelly
mikekelly / jsybus_geo_data
Created October 11, 2011 08:40
Bus Stop Geo Location Data
[
"AA BOX,
49.19379,
-2.03498,
2323,
3,
1",
"AALSMEER,
49.22448,
-2.06781,
{
"_links": {
"self": { "href": "/todo-list" },
"search": { "href": "/todo-list/search;{searchterm}" },
"description": { "href": "/todo-list/description" }
},
"_embedded": {
"item": [
{
"_links": {
@mikekelly
mikekelly / resource-state.hal.json
Created November 25, 2011 11:10
Example of resource state
{
"name": "A product",
"weight": 400,
"dimensions": {
"width": 100,
"height": 10,
"depth": 100
},
"description": "A great product"
}
var GEO_LOCATION = {
watchID: null,
callback: null
};
GEO_LOCATION.mySpot = function(position){
var lat = (position.coords) ? new String(position.coords.latitude) : position.x;
var lon = (position.coords) ? new String(position.coords.longitude) : position.y;
return GEO_LOCATION.callback(lat, lon);
}