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
// 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
// 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
[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
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
class Calculator | |
def add(a, b) | |
return a+b | |
end | |
def subtract(a, b) | |
return a-b | |
end |
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
{ | |
"jsonrpc": "2.0", | |
"id": "Ke43jnGeQsk2z9GYvFmrax", | |
"method": "add", | |
"params": [1, 5.1] | |
} |
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
{ | |
"jsonrpc": "2.0", | |
"result": 6.1, | |
"id": "Ke43jnGeQsk2z9GYvFmrax" | |
} |
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
#!/usr/bin/env ruby | |
require 'redis' | |
require 'securerandom' | |
require 'json' | |
# connect to Redis | |
redis_client = Redis.connect(url: 'redis://localhost:6379') | |
# request id will be used as the name of the return queue | |
request = { |
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
#!/usr/bin/env ruby | |
require 'redis' | |
require 'json' | |
require './calculator' | |
calculator = Calculator.new | |
# connect to Redis | |
redis_client = Redis.connect(url: 'redis://localhost:6379') |