Skip to content

Instantly share code, notes, and snippets.

@Irio
Irio / gist:8816865
Last active August 29, 2015 13:56
Summary of neighborly-balanced
# 1. Configuration
require 'balanced'
Balanced.configure('OUR_API_KEY_SECRET_HERE')
# 2. Our first request: creating customer
customer = Balanced::Customer.new(meta: { user_id: rand },
name: 'Juquinha',
email: 'juquinha@example.com')
customer.save
user_uri = customer.uri
@Irio
Irio / gist:9367464
Last active August 29, 2015 13:57
Downloading Atom text editor
cd ~/Downloads
curl -L https://www.atom.io/api/updates/download -A "Atom/0.1 CFNetwork/1.5" > Atom.zip
unzip Atom.zip
mv Atom.app /Applications
rm Atom.zip
@Irio
Irio / .vimrc
Created March 14, 2014 02:32
Who needs an IDE for Fortran?
:map <F5> <ESC>:w<CR>:!gfortran %:p && ./a.out;<CR>
@Irio
Irio / gist:10310238
Created April 9, 2014 20:19
nil=>nil
> ProjectTotal.first.attributes
ProjectTotal Load (1.8ms) SELECT "project_totals".* FROM "project_totals" LIMIT 1
=> {"project_id"=>13, "pledged"=>#<BigDecimal:7fe90f8b3558,'0.18E3',9(18)>, "progress"=>#<BigDecimal:7fe90f8b34e0,'0.2465753424 65753425E0',18(36)>, "total_payment_service_fee"=>#<BigDecimal:7fe90f8b3490,'0.0',9(18)>, "total_contributions"=>4, nil=>nil}
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
@Irio
Irio / update-flash-helper-for-rails41.patch
Created May 10, 2014 00:09
[Neighborly patch] Use string keys to filter flash messages
From ad41bc44ebc302b70268bfe4323e4cc338290eaa Mon Sep 17 00:00:00 2001
From: Irio Irineu Musskopf Junior <iirineu@gmail.com>
Date: Fri, 9 May 2014 20:58:24 -0300
Subject: [PATCH] Use string keys to filter flash messages
I am not sure what has changed in ActionDispatch::Flash::FlashHash, but
reading its source code, it's pretty obvious that flash keys are internally
stored as strings.
---
app/helpers/flash_messages_helper.rb | 2 +-
@Irio
Irio / Vagrantfile
Last active August 29, 2015 14:02
fgrehm/ventriloquist#62 - "address already in use" on starting PostgreSQL
Vagrant.configure('2') do |config|
config.vm.box = 'neighborly'
config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box'
config.vm.provision :ventriloquist do |env|
env.packages << %w(imagemagick postgresql-contrib)
env.platforms << %w(ruby)
env.services << %w(postgres-9.3 redis-2.8)
end
end
@Irio
Irio / gist:430a457be0a5d8ab580d
Created July 9, 2014 18:10
Function composition and application in Haskell
sumArgs :: Integer -> Integer -> Integer
sumArgs x y = x + y
times10 :: Integer -> Integer
times10 x = x * 10
-- times10 . sumArgs 1 2 will become
-- > let composed = \x -> times10 (sumArgs x)
-- > composed 1 2
-- error!
@Irio
Irio / gist:596bd175261f34e49cf9
Created August 6, 2014 21:13
select valid params from request
params.compact.keep(*FILTER).each do |name|
#send
end
@Irio
Irio / real_dummy_app.sh
Last active August 29, 2015 14:05
Script to migrate Neighborly's payment engines to use Neighborly itself as "dummy app"
# Save this file in the same folder as both
# Neighborly and gem repositories are.
#
# $ ./real_dummy_app.sh neighborly-balanced-bankaccount
GEM_NAME=$1
# luminopolis folder
git clone git@github.com:neighborly/`echo $GEM_NAME`.git
cd neighborly
bundle exec rake db:drop