This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
payment_frequency: | |
control: | |
creator: window.FormHelper.createInput | |
type: 'hidden' | |
serializer: (val, $root) -> | |
freq = $root.find('[name=income_frequency]').find(':selected').val() | |
if freq == 'Weekly' then 'Bi-weekly' else freq |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[foo]$ haste-boot | |
Downloading base libs from GitHub | |
Sending: | |
GET /haste-libs/haste-libs-0.2.99.tar.bz2 HTTP/1.1 | |
Host: valderman.github.io | |
Creating new connection to valderman.github.io | |
Received: | |
HTTP/1.1 200 OK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Errors from Batch Request (Barrister) | |
initApp(function(err, TodoManager, BatchTodoManager) { | |
TodoManager.readTodos(function(err, todos) { | |
for (var i = 0, len = todos.length; i < len; i++) { | |
BatchTodoManager.deleteTodo(todos[i]['id']); | |
} | |
BatchTodoManager.send(function(err, results) { | |
var result, i, len; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initializing API Client (Barrister) | |
function initApp(callback) { | |
var client = Barrister.httpClient({ | |
'endpoint': '/todos', | |
'interfaces': ['TodoManager'] | |
}); | |
client.loadContract(function() { | |
var batch, proxy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Receiving Error Code on Client | |
var lastTodoId = 45; | |
$('#todos li').click(function(e) { | |
var $tgt = $(e.target), todoId = $tgt.prop('id'); | |
TodoManager.deleteTodo(todoId, function(err) { | |
if (err.code === 1004) { | |
alert(err.message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Changing TodoManager Implementation | |
server.addHandler('TodoManager', { | |
'readTodos': function(callback) { | |
callback(null, store.getAll()); | |
}, | |
'createTodo': function(props, callback) { | |
callback(null, store.save(props)); | |
}, | |
'updateTodo': function(id, props, callback) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface TodoManager { | |
// returns all Todos | |
readTodos() []Todo | |
// creates new Todo and returns it with an id | |
createTodo(todo TodoProperties) Todo | |
// updates Todo and returns it | |
updateTodo(todo Todo) Todo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Barrister Client Initialization | |
function initApp(callback) { | |
var client = Barrister.httpClient({ | |
'endpoint': '/todos', | |
'interfaces': ['TodoManager'] | |
}); | |
client.loadContract(function() { | |
var proxy = client.proxy('TodoManager'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Server: Barrister RPC + Express | |
var express = require('express') | |
, fs = require('fs') | |
, http = require('http') | |
, path = require('path') | |
, barrister = require('barrister') | |
, store = require("./store").store | |
, idl = JSON.parse(fs.readFileSync("./todo_manager.json").toString()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// todo_manager.idl | |
struct TodoProperties { | |
title string | |
completed bool | |
} | |
struct Todo extends TodoProperties { | |
id int [optional] | |
} |