Skip to content

Instantly share code, notes, and snippets.

View cairesr's full-sized avatar
🏠
Working from home

Rodrigo Caires Rossetti Gai cairesr

🏠
Working from home
View GitHub Profile
@cairesr
cairesr / stripe_charges_by_payout.rb
Last active June 29, 2018 19:04
Stripe API: List of Charges by Payout
def retrieve_charges_from_payout(payout_id, stripe_custom_account)
payout = Stripe::Payout.retrieve(payout_id, stripe_account: stripe_custom_account)
balance_transaction = Stripe::BalanceTransaction.retrieve(
payout.balance_transaction, stripe_account: stripe_custom_account
)
balance_transaction_list = Stripe::BalanceTransaction.list(
{payout: payout_id},
stripe_account: stripe_custom_account
@cairesr
cairesr / clojure_seq_functions.md
Last active September 4, 2016 21:44
Clojure Seq Functions (based on Clojure for the Brave and True)

Maps with multiple collections

As long as the function used can receive the number of params you're passing on, you can pass multiple collections to map.

(map str ["Y" "Y" "Z"] ["y" "y" "z"]) ; => ("Yy" "Yy" "Zz")

You can pass the map a collection of functions.

@cairesr
cairesr / clojure_functions_basics.md
Last active August 9, 2016 21:36
Clojure Functions Basics

Functions have always the same structure: an operator and n operands. The operator can be a function or an expression that returns a function.

(+ 1 2 3 4) ;; => 10
(* 1 2 3 4) ;; => 24
(first [1 2 3 4]) ;; => 1
(or + -) ;; => returns another function: + (PLUS) in this case
((or + -) 10 20) ;; => 30
((first [+ -]) 10 20) ;; => 30
@cairesr
cairesr / clojure_structures.md
Last active August 29, 2016 00:31
Clojure: structures

Clojure structure is always the same

(operator operand1 operand2 ... operandn)
(str "you say goodbye" "...and I say hello!")
(+ 1 2)
(map inc [1 2 3 4])

if statement

@cairesr
cairesr / emacs_cheatsheet.md
Last active April 28, 2024 02:14
Emacs Cheat Sheet for macOS

Basics

ctrl + g - quit any Emacs command

crtl-x b - new buffer

crtl-x k - kill buffer

ctrl-x Ctrl-f - find / create new file na

def virus_finder(n)
rest = n
total_five = 0
total_three = 0
while(rest >= 3 || rest >= 5)
if(rest % 3 == 0)
rest -= 3
total_five += 3
elsif(rest % 5 == 0)
@cairesr
cairesr / gist:38cca04963c8341471b7
Created November 2, 2014 20:50
neo4j - match by multiple labels
MATCH n
WHERE n:Track AND n:Bass
RETURN n
@cairesr
cairesr / node_by_id.txt
Last active August 29, 2015 14:08
Neo4j - MATCH node by id
MATCH (n) WHERE ID(n) = <id goes here> RETURN n
@cairesr
cairesr / cypher_MATCH_addedT.txt
Created November 2, 2014 18:00
Matches all added tracks
MATCH (t)<-[:ADDED_TO]-(addedT) RETURN t, addedT