Skip to content

Instantly share code, notes, and snippets.

View mikekelly's full-sized avatar

Mike Kelly mikekelly

View GitHub Profile
{
"_links": {
"self": { "href": "/orders/123" },
"shipment-type": { "href": "http://api.company.com/logistics/shipmenttypes/2" },
"warehouse": { "href": "http://api.company.com/logistics/warehouses/7449?Country=Australia" },
"products": [{
"href": "http://api.company.com/master/products/87",
"title": "Shirt"
},{
"href": "http://api.company.com/master/products/122",
<resource href="/">
<link rel="events" href="...">
</resource>
<control action="submit-completed-task" href="http://api.email-service.com/messages" method="POST" content-type="application/xml" >
<email>
<message>Tremendous. You finished {{task.name}}</message>
<sender>you@example.com</sender>
<recipient>you@example.com</recipient>
</email>
</control>
{
"_links": {
"self": { "href": "..." },
"productions": { "href": "..." }
}
}
class DashboardController < ResourceController
def get
# show dashboard
end
end
@mikekelly
mikekelly / install-pygtk.sh
Created December 18, 2011 12:43 — forked from ches/install-pygtk.sh
Install PyGTK via Homebrew and virtualenv
# This LOOKS pretty straightforward, but it took awhile to sort out issues with
# py2cairo and pygobject, so I hope I've saved you some time :-)
#
# This assumes you already subscribe to a nice clean virtualenvwrapper workflow
# -- see https://gist.github.com/771394 if you need advice on getting there.
# There are some optional dependencies omitted, so if you're going to be doing
# heavy development with these libs, you may want to look into them.
#
# We go to some configure option pains to avoid polluting the system-level
# Python, and `brew link`ing Cairo which is keg-only by default.
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);
}
@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"
}
{
"_links": {
"self": { "href": "/todo-list" },
"search": { "href": "/todo-list/search;{searchterm}" },
"description": { "href": "/todo-list/description" }
},
"_embedded": {
"item": [
{
"_links": {
@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,