Skip to content

Instantly share code, notes, and snippets.

@camshaft
camshaft / example.coffee
Created October 17, 2012 16:53
Webmachine.js
module.exports =
init: (req, options, next)->
next null, {}
# Returning non-true values will result in 404 Not Found.
# Default: true
resourceExists: (req, context, next)->
next null, true
@camshaft
camshaft / app.js
Created October 26, 2012 19:58
Angular.js Custom Validator
var deps = [
'myapp.services',
'myapp.directives',
'myapp.controllers'
];
var app = angular.module('myapp', deps);
%% Create the state
State1 = ot_text:create(),
%% Make an op. Let's say the request wanted to add "foo" at position 0
Op1 = #ot_text_r{i="foo",p=0},
%% Apply the operation
State2 = ot_text:apply(State1, [Op1]),
%% State2 now equals "foo"
@camshaft
camshaft / plugin.md
Created November 8, 2012 22:37
CI Panel

CI Panel

Requirements

  • Easy to get started
  • Easy to install/write a plugin

Plugin Interface

[
{
"transaction": "{id}",
"country": "...",
"amount": "...",
"experiment": "...",
"device": "...",
"longitude": "...",
"latitude": "...",
"timestamp": "..."
@camshaft
camshaft / src+head.json
Created November 13, 2012 18:39 — forked from timshadel/src+head.json
Idea for using src + HTTP HEAD or GET with Accept headers for embedding items into Collection+JSON
{ "collection" :
{
"version" : "1.0",
"href" : "http://example.org/friends/",
"items" :
[
{
"href" : "...",
"data" :
@camshaft
camshaft / src-head.json
Created November 13, 2012 18:42 — forked from timshadel/src-head.json
Idea for using src + HTTP HEAD or GET with Accept headers for embedding items into Collection+JSON
{ "collection" :
{
"version" : "1.0",
"href" : "http://example.org/friends/",
"items" :
[
{
"href" : "...",
"data" :
@camshaft
camshaft / profile.json
Created November 13, 2012 19:16
Facebook Graph in Collection+JSON
{
"collection" :
{
"version" : "1.0",
"href" : "https://graph.facebook.com/123456789",
"items" :
[
{
"href" : "https://graph.facebook.com/123456789",
@camshaft
camshaft / profile.json
Created November 13, 2012 19:39 — forked from timshadel/add-friend.json
What makes it media?
{
"name": "Toby Campbell",
"href": "http://profile.org/4165401",
"picture": "http://profile.org/4165401/picture",
"friends": {
"href": "http://profile.org/4165401/friends",
"data": [
{
"name" : "Hugo S. Horton",
"href" : "http://profile.org/250648607",
@camshaft
camshaft / engage.css
Created December 4, 2012 22:09
Engage layout
#main {
background: #eee;
padding: 20px;
}
#wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
background: #eee;