This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"postUrl":"", | |
"description":"", | |
"commentCount":1, | |
"likeCount":1, | |
"pubDate":"2022-04-20T16:20:00.000Z", | |
"likedByViewer":false, | |
"isSidecar":false, | |
"type":"Video", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// package.json | |
"dependencies": { | |
"node-cron": "^3.0.0" | |
} | |
// code.js | |
const cron = require('node-cron') | |
// Run currency refresh every 30 minutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dotenv = require('dotenv').config() | |
const { Client } = require('@notionhq/client') | |
const notion = new Client({ | |
auth: process.env.NOTION_TOKEN, | |
}) | |
const databaseId = process.env.NOTION_DATABASE_ID | |
const defaultCurrency = process.env.DEFAULT_CURRENCY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get most recent price of any currency listed at 'API de Moedas'. | |
* https://docs.awesomeapi.com.br/api-de-moedas | |
* | |
* Params: (from) - Currency Code. Ex: USD, BRL, NZD | |
* (to) - Currency Code. Ex: USD, BRL, NZD | |
**/ | |
async function fetchCurrencyPrice(from, to) { | |
try { | |
if (from.toUpperCase() == to.toUpperCase()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get most recent price of any crypto listed at CoinGecko. | |
* Params: (coin) - Crypto ID from CoinGecko, all crypto IDs can be found at: | |
* https://api.coingecko.com/api/v3/coins/list?include_platform=false | |
* (defaultCurrency) - Base Currency Code to calculate price. Ex: USD, BRL, NZD | |
**/ | |
async function fetchPriceOnCoinGecko(coin, defaultCurrency) { | |
try { | |
const response = await axios.get(`https://api.coingecko.com/api/v3/simple/price?ids=${coin}&vs_currencies=${defaultCurrency}`); | |
return response.data[`${coin}`][defaultCurrency.toLowerCase()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################# | |
# | |
# REQUIRES: | |
# - GitHub CLI (https://cli.github.com/) | |
# Script to automatically create default project structures | |
# along side its Github Repository, all integrated and with | |
# default 'first commit' pushed to remote repository. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
s = status | |
unstage = reset HEAD -- | |
undo = reset HEAD~1 --mixed | |
done = !git push origin HEAD | |
get = !git pull origin HEAD | |
go = checkout | |
back = checkout - | |
del = branch -D | |
new = checkout -b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
~/Library/Android/sdk/emulator/emulator -avd Nexus_5X_API_28_x86 -dns-server 8.8.8.8,8.8.4.4 & | |
osascript -e 'tell application "Terminal" to close first window' & exit | |
# Instead of 'Nexus_5X_API_28_x86', use your own emulator AVD image name, which can be found running the following command: | |
# ~/Library/Android/sdk/emulator/emulator -list-avds | |
# | |
# Also don't forget to give it execution permissions with "chmod +x". |