Skip to content

Instantly share code, notes, and snippets.

View timshadel's full-sized avatar

Tim Shadel timshadel

View GitHub Profile
@timshadel
timshadel / make_video.sh
Created February 11, 2011 18:50
Create a Gource visualization of the Rails codebase as it crosses into GitHub land...
# On a Mac
# brew install gource (http://code.google.com/p/gource/)
# brew install ffmpeg
# git clone https://github.com/rails/rails.git
# In the rails code directory, run this to see the same visualization
gource --hide bloom,files,filenames,dirnames --auto-skip-seconds 0.3 --seconds-per-day 0.003 --date-format "%B %Y" --start-position 0.2 --stop-position 0.45 --file-idle-time 10 --stop-at-end -1024x768
# Or do this to save it to a reusable video:
gource --hide bloom,files,filenames,dirnames --auto-skip-seconds 0.3 --seconds-per-day 0.003 --date-format "%B %Y" --start-position 0.2 --stop-position 0.45 --file-idle-time 10 --stop-at-end -1024x768 -o - | ffmpeg -y -b 3000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre slow -threads 0 rails-on-github.mp4
@timshadel
timshadel / .gitignore
Last active December 22, 2015 09:49 — forked from mbostock/.block
node_modules
@timshadel
timshadel / .gitignore
Last active December 22, 2015 09:29 — forked from mbostock/.block
node_modules

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:

DEBUG=connect:something,fn=requestLogger
@timshadel
timshadel / api-stack.js
Last active December 16, 2015 09:59
Middleware stack config ideas.
/**
* Module dependencies.
*/
var stack = require("simple-stack-common")
, cors = require("connect-xcors");
/**
* Expose the stack
*/
module.exports = exports = function(config) {
/**
* Module dependencies
*/
var knox = require('knox')
, async = require('async')
, url = require('url');
/**
* node fixheaders.js s3://bucket/prefix
*/
@timshadel
timshadel / test.md
Last active December 14, 2015 20:48

Straight

Add a staging deployment
$ heroku create myapp-stage -r stage
Creating myapp-stage... done, stack is cedar
http://myapp-stage.herokuapp.com/ | git@heroku.com:myapp-stage.git
Git remote stage added

Check that the git remote was named properly

Managing Multiple Environments on Heroku

Using Heroku to work with multiple environments can be pretty easy. The heroku tool can look at your git remotes to decide which app should receive the API commands.

Default Setup

The origin remote