Skip to content

Instantly share code, notes, and snippets.

@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" :
[
{
"transaction": "{id}",
"country": "...",
"amount": "...",
"experiment": "...",
"device": "...",
"longitude": "...",
"latitude": "...",
"timestamp": "..."
@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

%% 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 / 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);
@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 / angular.js
Created September 1, 2012 19:54
angular.js getter/setter
/**
* @license AngularJS v1.1.0-de024355
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, document, undefined) {
'use strict';
////////////////////////////////////
@camshaft
camshaft / example.js
Created August 15, 2012 19:23
Parallel service request
function(req, res) {
var response = {};
var urls = ["http://test.com", "http://other.test.com"];
// Iterate the urls
services.forEach(function(service){
get(service, function(err, data){
// Handle error
if(err) res.render('error', err);
@camshaft
camshaft / ember-data.js
Created July 14, 2012 19:04
Ember.js Data
(function() {
window.DS = Ember.Namespace.create({
CURRENT_API_REVISION: 4
});
})();
(function() {
@camshaft
camshaft / example-slide.html
Created June 25, 2012 20:52
Example presentation with reveal.js
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Nujii Studio</title>
<meta name="description" content="">
<meta name="author" content="Scott Wall">