Skip to content

Instantly share code, notes, and snippets.

View JpOnline's full-sized avatar

João Paulo de Souza Soares JpOnline

View GitHub Profile
@pyrtsa
pyrtsa / q_maps.clj
Last active June 20, 2019 21:00
Getting Datomic query results as a sequence of maps.
(defn q-maps
[query & args]
{:pre [(map? query)]}
(let [ks (map #(-> % name (subs 1) keyword) (:find query))
rs (apply datomic.api/q query args)]
(map (partial zipmap ks) rs)))
(q-maps {:find '[?id ?val]
:where '[[?e :id ?id] [?e :val ?val]]}
db)
@lucashmsilva
lucashmsilva / TESOURODIRETO(taxa).js
Last active January 11, 2024 13:26
API para criar a função TESOURODIRETO Google Sheets
/*
* @return Retorna a cotação atual de um título específico do Tesouro Direto Junto com a taxa anual de retorno
* @customfunction
**/
function TESOURODIRETO(bondName) {
let srcURL = "https://www.tesourodireto.com.br/json/br/com/b3/tesourodireto/service/api/treasurybondsinfo.json";
let jsonData = UrlFetchApp.fetch(srcURL);
let parsedData = JSON.parse(jsonData.getContentText()).response;
for(let bond of parsedData.TrsrBdTradgList) {