Skip to content

Instantly share code, notes, and snippets.

alert("Oops!")
(+ 1 2)
; KEYWORDS
; used to map values in hashes
(def person {:name "Andre"
:city "Florianopolis"})
; Keywords are functions that look themselves up in collections passed to them.
@dreoliv
dreoliv / settle_braintree.rb
Created March 22, 2015 14:36
Settle braintree transaction via API
Braintree::Configuration.instantiate.http.put "/transactions/#{transaction.id}/settle"
  • Minimize real dollar impact to donors by voiding on braintree before settlement
  • Correct totals online - I made a script for this. Might be safer to run the query first and see what it returns before voiding.
recurring_transfers = RecurringAccountTransfer.due.pluck(:id)

Transaction.where(recurring_account_transfer_id: recurring_transfers).each do |transaction|
  transaction.void!
end
@dreoliv
dreoliv / vim_awesomeness.md
Created December 11, 2013 13:06
Vim awesomeness

Copy current filename to clipboard

:let @+ = expand("%")

Paste last yank

"0p

The registry 0 always keep the last yanked text.

@dreoliv
dreoliv / tmux_cheat_sheet.md
Created August 5, 2013 19:45
Tmux cheat sheet

Session

  • Rename session: <C-a> $
  • List existing sessions: tmux list-sessions
  • Attach to an existing session: tmux at -t
@dreoliv
dreoliv / retorno_issintel
Created August 4, 2013 18:59
Retorno ISSIntel
"bank_code"=>nil,
"barcode_data"=>"81600000000590012342013081000000000000003332",
"city_hall_id"=>29,
"created_at"=>"2013-07-23T10:08:05-03:00",
"da_fees_cents"=>0,
"delta"=>false,
"discount_cents"=>0,
"document_number"=>3332,
"emission_date"=>"2013-07-23",
"expiration_date"=>"2013-08-10",
@dreoliv
dreoliv / new_gist_file
Created July 29, 2013 17:24
Semaphore commands
export RUBY_GC_MALLOC_LIMIT=1000000000 && export RUBY_FREE_MIN=500000 && export RUBY_HEAP_MIN_SLOTS=40000
@dreoliv
dreoliv / new_gist_file
Created May 30, 2013 13:25
Delete all local branches except master
git branch -D `git branch | awk '{ if ($0 !~ /master/) printf "%s", $0 }'`
@dreoliv
dreoliv / new_gist_file
Created May 30, 2013 12:04
Load postgres dump
pg_restore --verbose --clean --no-acl --no-owner -d tributario_development latest.dump