Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am smizell on github.
  • I am smizell (https://keybase.io/smizell) on keybase.
  • I have a public key ASA6Hq_DyR581YFdOxPy9eU9ZS1gSHvaEZ8kW8u0DXp9WAo

To claim this, I am signing this object:

View reusing-user.md

FORMAT: 1A

User Example

Example of reusing model

Group Users

User [/users/{id}]

  • Model (application/json)
View recursive-hal.md

Recursive HAL

There are a few steps you can take to simplify HAL even more than it is by making links recursive resources. It requires these changes.

  1. Add a _href property to be used to specify the URI of the resource. This would replace using self links.
  2. Change templated to _templated
  3. Change hreflang to _hreflang
  4. Change title to _title
  5. Consider links to be full HAL objects
@smizell
smizell / vnd.error.xml
Created Jul 31, 2014
ALPS doc for defining semantics and links for error messages, as taken from the vnd.error media type
View vnd.error.xml
<alps version="1.0">
<descriptor id="error" type="semantic">
<doc>Error Message</doc>
<descriptor id="message" type="semantic">
<doc>
For expressing a human readable message related to the current error which may be displayed to the user of the api
</doc>
</descriptor>
View action-inputs.xml
<uber version="1.0">
<data rel="item" url="http://example.org/1">
<data name="givenName">Mike</data>
<data name="familyName">Amundsen</data>
<data name="hatsize">Medium</data>
<data name="update" action="replace" url="http://example.org/1">
<data name="familyName">
<data name="required">true</data>
</data>
<data name="givenName" />
@smizell
smizell / gist:2511298
Created Apr 27, 2012
MySQL Backup Script (Bash)
View gist:2511298
#!/bin/sh
#backup all mysql databases
# list MySQL databases and dump each
DIR=/backup/mysql/
DATESTAMP=$(date +%Y%m%d)
DB_USER=mysqlbackup
DB_PASS=kate@racers#45
# remove old backups
find ${DIR} -type f -mtime +5 -exec rm -rf {} \;
View gist:2502461
window.MobileAppCollection = Backbone.Collection.extend
url: "http://kate.murraystate.edu/api/v1/mobile_app/"
model: MobileApp
window.MobileApp = Backbone.Model.extend
urlRoot: "http://kate.murraystate.edu/api/v1/mobile_app/"
url: () ->
base = @urlRoot || (@collection && @collection.url)
@smizell
smizell / get_query
Created Mar 27, 2012
Query String Templatetag
View get_query
import urllib
from django import template
from django.conf import settings
register = template.Library()
class GetQuery(template.Node):
def __init__(self, query_dict, key, value):
@smizell
smizell / gist:611766
Created Oct 5, 2010
Chrome Frame Django Middleware
View gist:611766
from django.conf import settings
class ChromeFrameMiddleware(object):
"""
Adds the Google Chrome Frame meta tag to your page
If you don't want it to check if Chrome Frame is installed,
put this in your settings.py file.
CHROME_CHECK = False