Skip to content

Instantly share code, notes, and snippets.

@melendezgg
melendezgg / cabys_a_json.py
Last active February 1, 2024 20:35
Convertir el archivo Excel del catálogo CABYS del Banco Central de Costa Rica, a un archivo JSON en el formato API Ministerio de Hacienda
from pandas import read_excel
import json
URL = 'https://www.bccr.fi.cr/indicadores-economicos/cabys/Cabys_catalogo_historial_de_cambios.xlsx'
# Los nombres de las columnas Excel vs nombres cortos y eventualmente
# propiedades del json
cols = {
'Descripción (categoría 1)': 'c1',
'Descripción (categoría 2)': 'c2',
@fervous
fervous / functions.php
Last active February 11, 2021 13:00
Add Vendor Address and Info to Customer emails Order Confirmation WC Vendors
add_action( 'woocommerce_add_order_item_meta', 'bwd_add_vendor_to_order_item_meta', 10, 2);
function bwd_add_vendor_to_order_item_meta( $item_id, $cart_item) {
$vendor_id = $cart_item[ 'data' ]->post->post_author;
// build up address
$address1 = get_user_meta( $vendor_id , '_wcv_store_address1', true );
$address2 = get_user_meta( $vendor_id , '_wcv_store_address2', true );
$city = get_user_meta( $vendor_id , '_wcv_store_city', true );
$store_postcode = get_user_meta( $vendor_id , '_wcv_store_postcode', true );
$address = ( $address1 != '') ? $address1 .', ' . $city .', '. $store_postcode :'';
@larc000
larc000 / node-copy-to-bin
Created May 12, 2015 04:07
Node version default using NVM. One copy of node globally so that other users can access it, and use nvm to switch between your development versions.
nvm use v0.10.33
n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local
@stefansundin
stefansundin / install-pre-commit.sh
Last active September 17, 2023 11:46
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding: