Skip to content

Instantly share code, notes, and snippets.

View yhauxell's full-sized avatar
⌨️
Coding, always!

Yausell Ruiz yhauxell

⌨️
Coding, always!
View GitHub Profile
@yhauxell
yhauxell / git_numstat_summary.bash
Created September 7, 2023 13:26
Get changes stats over current branch on git repos
function git_numstat_summary() {
CURRENT=$(git branch --show-current)
FILES=$(git diff --name-only main...HEAD | wc -l)
echo "Files changed"
echo "$FILES files"
echo "Lines changed"
function gitsync(){
CURRENT=$(git branch --show-current)
if [ -n "$1" ]
then
echo "Fetching branch $1"
git fetch origin $1:$1
echo "Merging $1 into $CURRENT"
git merge $1 -m "Merged branch $1 into $CURRENT"
@yhauxell
yhauxell / coingecko-api-google-sheet.js
Last active July 19, 2022 09:03
Get coin data from CoinGecko API into google sheet
function COINGECKO(input = 'bitcoin', property = 'all', currency = 'usd') {
Logger.log(`Search for #> ${input} @prop: ${property} @currency: ${currency}`);
const cache = CacheService.getScriptCache();
let coinData = cache.get(input);
if(!coinData){
Logger.log('No cached coin data found! Let\'s fetch the api');
const URL = `https://api.coingecko.com/api/v3/coins/markets?vs_currency=${currency}&ids=${input}&price_change_percentage=24h,7d,14d,30d,1y`;
try{
@yhauxell
yhauxell / coinmarketcap-CRYPTOPRICE.js
Last active January 5, 2021 16:10
Scrap price data from coinmarketcap into google sheet
/**
This function is intended to be used as (google app script)[https://developers.google.com/apps-script/guides/sheets/functions#using_a_custom_function] inside google sheets to load the price for a given coin name from coinmarketcap
Since google sheet makes exahustive calls to their functions this one has implemented a cache mechanism to prevent calling cooinmarketcap constantly and being banned easily
The cache last 30 minutes but can be reseted by passing true as second param to the function in your sheet cell
usage:
| A1 | A2
| bitcoin | =CRYPTOPRICE(A1)
Forced price refresh: