Skip to content

Instantly share code, notes, and snippets.

@rserna2010
rserna2010 / snakecase.rb
Created September 5, 2013 06:09
Turn Camelcase into Snakecase
output = this_is_camel_case
SPLIT words at upcase ignoring first upcase
at split add _
Join them
downcase entire string
input = 'ThisIsCamelCass'
@rserna2010
rserna2010 / form-validator.js
Last active December 22, 2015 09:39 — forked from ksolo/form-validator.js
Form Validation
// shorthand for $(document).ready();
$(function(){
$("form").on('submit', function(e){
e.preventDefault();
var email_input = $("form").find("input[name=email]").val()
var password_input = $("form").find("input[name=password]").val()
if (validateEmail(email_input)){
@rserna2010
rserna2010 / index.html
Created September 10, 2013 02:43 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@rserna2010
rserna2010 / gist:7774217
Created December 3, 2013 18:01
Using CURL to Debit Bank Account
#CREATE CUSTOMER
curl https://api.balancedpayments.com/v1/customers \
> -u ak-test-PE0kAimMqYDGzebPIHUzYwuLUM86yCxP: \
> -X POST
OUTPUT: "/v1/customers/CU6kyXpjGEDyJXYbSrkTijLc"
#CREATE BANK ACOUNT
curl https://api.balancedpayments.com/v1/bank_accounts \
-u ak-test-PE0kAimMqYDGzebPIHUzYwuLUM86yCxP: \
marketplace.create_card(:card_number => '5105105105105100',
:expiration_month => '1',
:expiration_year => '2020',
:security_code => '123'
).save
@rserna2010
rserna2010 / gist:8047320
Created December 19, 2013 22:28
.gitmodules
[submodule "clients/rev0/python"]
path = clients/rev0/python
url = https://github.com/balanced/balanced-python.git
[submodule "clients/rev0/ruby"]
path = clients/rev0/ruby
url = https://github.com/balanced/balanced-ruby.git
[submodule "clients/rev1/ruby"]
path = clients/rev1/ruby
url = https://github.com/balanced/balanced-ruby.git
branch = 1.1.0
@rserna2010
rserna2010 / gist:8047324
Created December 19, 2013 22:28
.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = false
[remote "origin"]
url = https://github.com/balanced/balanced-docs.git
fetch = +refs/heads/*:refs/remotes/origin/*
REV=rev1 REV_NUM=1.1 make build-revisions
rm -rf site/1.1
make[1]: Circular site/static/js/compiled.js <- site/static/js/compiled.js dependency dropped.
BALANCED_REV=rev1 sphinx-build -b dirhtml -c api/rev1 api/rev1 api/rev1/html
Traceback (most recent call last):
File "/usr/local/bin/sphinx-build", line 5, in <module>
from pkg_resources import load_entry_point
File "/Users/ryan/.venvburrito/lib/python/distribute-0.6.35-py2.7.egg/pkg_resources.py", line 2805, in <module>
working_set.require(__requires__)
File "/Users/ryan/.venvburrito/lib/python/distribute-0.6.35-py2.7.egg/pkg_resources.py", line 696, in require
Traceback (most recent call last):
File "scripts/lang-scenario.py", line 709, in <module>
main()
File "scripts/lang-scenario.py", line 704, in main
blocks, response = scenario()
File "scripts/lang-scenario.py", line 443, in __call__
block = self.block(lang)
File "scripts/lang-scenario.py", line 462, in block
block = self._render(template_path)
File "scripts/lang-scenario.py", line 494, in _render
@rserna2010
rserna2010 / gist:8150938
Created December 27, 2013 18:43
Adding a customer
1) create customer
curl https://api.balancedpayments.com/v1/customers \
-u KEY_SECRET: \
-X POST
2) Add credit card
curl https://api.balancedpayments.com/v1/marketplaces/MARKETPLACE_URI/cards \
-u KEY_SECRET: \
-d "expiration_month=12" \
-d "security_code=123" \