Skip to content

Instantly share code, notes, and snippets.

View tmornini's full-sized avatar

Tom Mornini tmornini

View GitHub Profile
source 'https://rubygems.org'
gem 'bcrypt-ruby', :require => 'bcrypt'
# unauthenticated client
client = Subledger.new
identity_args = { :description => '',
:email => '' }
identity, key = client.
identities.
create identity_args
@tmornini
tmornini / balance sheet
Created October 2, 2013 06:56
Subledger's first balance sheet and income statement, based upon Sam Carpenter's original demo app. One transaction in, the company has a $513 profit! :-) But where in the world is the report's description? :-(
{
"id": "TqNGddkj4zU84KGjf5eYq2",
"book": "hTEokfDKuFi0EdSEOuUE14",
"report": "KdYr7C7ySmdohI7Bo7Z3H3",
"effective_at": "2013-10-02T06:22:08Z",
"total_accounts": 12,
"progress": {
"percentage": 100
},
"rendered_at": "2013-10-02T06:22:08.798Z",
irb(main):011:0> [1][0..-1]
=> [1] # makes sense
irb(main):012:0> [1][1..-1]
=> [] # WTF?
irb(main):013:0> [1][2..-1]
=> nil # makes sense
With single satoshi addresses
-----------------------------
Top 100%
---------------------------------------------------------------------------------------------------
| Total | Percentage | Average | Min | Max |
---------------------------------------------------------------------------------------------------
| 0.00216157 | 0.00000002 | 0.00000001 | 0.00000001 | 0.00000001 |
| 0.00253359 | 0.00000002 | 0.00000001 | 0.00000001 | 0.00000004 |
| 0.04517230 | 0.00000037 | 0.00000021 | 0.00000004 | 0.00000039 |
@tmornini
tmornini / 2.0.0-p451
Last active August 29, 2015 13:57
Segfault in Ruby 2.1.0 and 2.1.1, Mac OS X 10.9.2
ruby: 2.0.0-p451 | master *%
v3 $ ./example.rb
./example.rb:14:in `<module:Subledger>': Subledger::BadRequest
from ./example.rb:3:in `<main>'
require 'uri'
require 'reel'
require 'subledger/json'
require 'subledger/uuid'
module Subledger
module Server
class Reel < Reel::Server::HTTP
E, [2014-04-06T12:10:05.837299 #58542] ERROR -- : MyServer crashed!
Reel::StateError: already processing a request
@tmornini
tmornini / gist:10551841
Last active November 24, 2015 19:04
Subledger v2 create_and_post JSON body
{
"effective_at": "ISO8601 Date/Time",
"description": "Free form text",
"reference": "URL",
"lines": [
{
"account": "account_id",
"value": {
"type": "debit",
"amount": "10.00"
Q) What is Subledger?
A) Subledger is a modern double-entry ledger and financial report API for mobile and web app developers.
Q) What is Subledger's purpose?
A) Subledger's purpose is to give developers the tools to maintain more accurate, detailed and actionable
financial information than they would if they built it themselves.
Q) Is Subledger difficult to use?
A) No. It is easier, less expensive and less risky than building something equivalent. Subledger customers have greatly
simplified their code bases, reduced their operational responsibility, and reduced the latency and complexity of their