Skip to content

Instantly share code, notes, and snippets.

var Balanced = (function () {
var capabilities = {
system_timezone:-(new Date()).getTimezoneOffset() / 60,
user_agent:navigator.userAgent,
language:navigator.language
};
function validateData (requiredKeys, data, errors) {
for (var i = 0; i < requiredKeys.length; i++) {
var key = requiredKeys[i];
[10:15:10 matthew]% irb ~/balanced/balanc
irb(main):001:0> require 'balanced'
=> true
irb(main):002:0> Balanced.configure('83b9b666cd9411e2b213026ba7cac9da')
=> #<Balanced::Client:0x000000026f0a70 @api_key="83b9b666cd9411e2b213026ba7cac9da", @config={:scheme=>"https", :host=>"api.balancedpayments.com", :port=>443, :version=>"1", :logging_level=>"WARN", :connection_timeout=>30, :read_timeout=>30, :logger=>nil, :ssl_verify=>true, :faraday_adapter=>:net_http}, @conn=#<Faraday::Connection:0x000000026e7ad8 @headers={"User-Agent"=>"balanced-ruby/0.7.1"}, @params={}, @options={:open_timeout=>30, :timeout=>30}, @ssl={:verify=>true}, @parallel_manager=nil, @default_parallel_manager=nil, @builder=#<Faraday::Builder:0x000000026e79c0 @handlers=[FaradayMiddleware::EncodeJson, Faraday::Response::Logger, Faraday::Response::RaiseBalancedError, FaradayMiddleware::ParseJson, Faraday::Adapter::NetHttp]>, @url_prefix=#<URI::HTTPS:0x000000026e7cb8 URL:
[ 80.835] (EE)
[ 80.835] (EE) Backtrace:
[ 80.866] (EE) 0: /usr/bin/X (xorg_backtrace+0x36) [0x58a426]
[ 80.866] (EE) 1: /usr/bin/X (0x400000+0x18e279) [0x58e279]
[ 80.866] (EE) 2: /usr/lib/libpthread.so.0 (0x7f5077329000+0xf1e0) [0x7f50773381e0]
[ 80.866] (EE) 3: /usr/lib/xorg/modules/drivers/nvidia_drv.so (0x7f5074717000+0xfcae1) [0x7f5074813ae1]
[ 80.866] (EE) 4: /usr/lib/xorg/modules/drivers/nvidia_drv.so (0x7f5074717000+0x543ce8) [0x7f5074c5ace8]
[ 80.866] (EE) 5: /usr/bin/X (0x400000+0x17a6c3) [0x57a6c3]
[ 80.866] (EE) 6: /usr/lib/xorg/modules/drivers/nvidia_drv.so (0x7f5074717000+0x50391a) [0x7f5074c1a91a]
[ 80.866] (EE) 7: /usr/bin/X (0x400000+0xc4ae0) [0x4c4ae0]
[{"attribution":null,"tags":[],"type":"image","location":{"latitude":37.442283174,"name":"Whole Foods Market","longitude":-122.159368017,"id":1178},"comments":{"count":1,"data":[{"created_time":"1350103607","text":"Love this picture? Check out my gallery at http://instacanv.as/smartwatermelon","from":{"username":"smartwatermelon","profile_picture":"http://images.instagram.com/profiles/profile_30712150_75sq_1334523529.jpg","id":"30712150","full_name":"Andrew Rich"},"id":"301013334694666156"}]},"filter":"Rise","created_time":"1350103507","link":"http://instagr.am/p/QtaUYBoZ8T/","likes":{"count":0,"data":[]},"images":{"low_resolution":{"url":"http://distilleryimage3.s3.amazonaws.com/c38165ee14f011e284a91231382040e4_6.jpg","width":306,"height":306},"thumbnail":{"url":"http://distilleryimage3.s3.amazonaws.com/c38165ee14f011e284a91231382040e4_5.jpg","width":150,"height":150},"standard_resolution":{"url":"http://distilleryimage3.s3.amazonaws.com/c38165ee14f011e284a91231382040e4_7.jpg","width":612,"height":612}},"cap
@matthewfl
matthewfl / Makefile
Last active October 10, 2015 11:18
Simple makefile for generating all the pdfs based off latex files in a dir and sub dir
Latex = $(wildcard **/*.tex) $(wildcard *.tex)
Pdfs = $(Latex:.tex=.pdf)
all: $(Pdfs)
%.pdf: %.tex
rm -f $@
latex --output-format=pdf -output-directory=$(dir $@) $<
p:
@matthewfl
matthewfl / cmucam_test.pde
Created February 13, 2012 06:17
display the image for a cmucam that is directly connected
import processing.serial.*;
Serial cmucam;
void setup () {
cmucam = new Serial(this, "/dev/tty.usbserial-A400C1Q8", 115200);
size(200, 200);
delay(1500);
cmucam.write("RS\r");
delay(150);
@matthewfl
matthewfl / gist:1062801
Created July 4, 2011 01:44
npm safe attempt
npm.load({}, function (err) {
//npm.commands.build = console.log; // failed because no setter was set
//npm.commands['run-script'] = console.log;
//Object.defineProperty(npm.commands, "build", { get: function () { return console.log; }}); // could not redefine the property
//Object.defineProperty(npm.commands, "run-script", { value: console.log });
// seems to work, but crashes after some point in the process
var original_npm = npm.commands;
npm.commands = {}; // more hacks, to make npm safe
for(var c in original_npm) {
(function (c) {
@matthewfl
matthewfl / mac load apps from Applications.sh
Created December 31, 2010 07:14
An attempt to load application from the Applications folder into the command line
for a in /Applications/*; do
base=`echo $a | sed 's/\/Applications\/\(.*\)\.app/\1/'`
if [ $base != $a ]; then
name=`echo ${base:l} | sed 's/[^a-z0-9_]/\-/g'`
alias $name="open -a \"$base\" --args"
fi
done
@matthewfl
matthewfl / mac load apps from Applications.sh
Created December 31, 2010 07:14
An attempt to load application from the Applications folder into the command line
for a in /Applications/*; do
base=`echo $a | sed 's/\/Applications\/\(.*\)\.app/\1/'`
if [ $base != $a ]; then
name=`echo ${base:l} | sed 's/[^a-z0-9_]/\-/g'`
alias $name="\"/Applications/$base.app/Contents/MacOS/$base\""
fi
done
@matthewfl
matthewfl / async.js
Created November 28, 2010 05:01
A async function that I wrote as everything else seemed too complex for what I needed
function async (fun, args) {
if(!fun.length) return;
args = args || [];
var call=fun.shift();
if(typeof call == "function") call = [ call ];
var count=call.length;
var n=0;
var ret=[];
while(call.length) {
call.shift().apply((function (num){