Skip to content

Instantly share code, notes, and snippets.

So the brilliance of hypermedia is that it's a protocol programming language: the client is the generic execution environment, and the server is the "programmer" which sends tiny little chunks of programs down to the client to dictate what actions may be taken next, given its context.

The fact that the client also builds a UI is irrelevant to this power. The power is in creating a dynamic, custom protocol by choosing for the client which message structures that will be sent from the client, which is done using merely the tools of hypermedia. The protocol between a client and server is then codified in the hypermedia (e.g. HTML) part of the code which uses links and forms to document the various messages which may pass between client and server, and the client states in which either may be used.

Armstrong's formula for a good protocol:

Client-State, Client-Message => Server-State, Server-Response-Message

But in hypermedia, the server's response dictate's the client state:

anonymous
anonymous / .phoenix.js
Created August 12, 2014 03:47
// Key combinations
var hyper = ['ctrl','alt','cmd','shift'];
var mash = ['ctrl','alt','cmd'];
// Screen placement movement
api.bind('h', mash, function() { to_left(1, 2); }); // left
api.bind('l', mash, function() { to_right(1, 2); }); // right
api.bind('k', mash, function() { to_top(1, 2); }); // up
api.bind('j', mash, function() { to_bottom(1, 2); }); // down
api.bind('.', mash, function() { to_bottom_right(1, 2); }); // bottom-right
@jowl
jowl / gitshot
Created September 17, 2012 11:48
Take photo automatically after every git commit. Run `gitshot --enable` in project base dir to enable.
#!/usr/bin/env ruby
require 'fileutils'
APP = __FILE__.split('/').last
pwd = Dir.pwd
if ARGV.include? '--enable'
post_commit = File.join(pwd,'.git/hooks/post-commit')
abort('post commit hook already exist!') if File.exists?(post_commit)
@jsmpereira
jsmpereira / gist:1094024
Created July 19, 2011 23:46
Padrino pagination
#
# Adapted from http://pastebin.com/FL5KeQQH
#
# As mentioned on the link above put this on app/helpers/pagination.rb
# and you can use in your view
#
# =will_paginate @posts
#
# I'm also using this https://gist.github.com/837683
#