Skip to content

Instantly share code, notes, and snippets.

View steps.md
  • 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 / settle_braintree.rb
Created Mar 22, 2015
Settle braintree transaction via API
View settle_braintree.rb
Braintree::Configuration.instantiate.http.put "/transactions/#{transaction.id}/settle"
View clojure_notes.clj
(+ 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 / gist:3048530
Created Jul 4, 2012
Indirect object creation
View gist:3048530

Inject factory method

Use for spawning multiple objects

class Foo

  attr_writer :bar_source


  private
@dreoliv
dreoliv / new_gist_file
Created May 30, 2013
Load postgres dump
View new_gist_file
pg_restore --verbose --clean --no-acl --no-owner -d tributario_development latest.dump
@dreoliv
dreoliv / new_gist_file
Created May 30, 2013
Delete all local branches except master
View new_gist_file
git branch -D `git branch | awk '{ if ($0 !~ /master/) printf "%s", $0 }'`
@dreoliv
dreoliv / new_gist_file
Created Jul 29, 2013
Semaphore commands
View new_gist_file
export RUBY_GC_MALLOC_LIMIT=1000000000 && export RUBY_FREE_MIN=500000 && export RUBY_HEAP_MIN_SLOTS=40000
View 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",
View tmux_cheat_sheet.md

Session

  • Rename session: <C-a> $
  • List existing sessions: tmux list-sessions
  • Attach to an existing session: tmux at -t <session name>
View vim_awesomeness.md

Copy current filename to clipboard

:let @+ = expand("%")

Paste last yank

"0p

The registry 0 always keep the last yanked text.