Skip to content

Instantly share code, notes, and snippets.

View iloveitaly's full-sized avatar

Michael Bianco iloveitaly

View GitHub Profile
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[pack] )); then
source "$(pack completion --shell zsh)"
fi
@iloveitaly
iloveitaly / 1password.zsh
Last active October 31, 2023 14:43
a zsh plug-in to load the one password shell completions and plugin environment variables
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[op] )); then
eval "$(op completion zsh)"
compdef _op op
# load plugins configuration
if [[ -f ~/.config/op/plugins.sh ]]; then
source ~/.config/op/plugins.sh
fi
fi
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[orbctl] )); then
eval "$(orbctl completion zsh)"
compdef _orb orbctl
compdef _orb orb
fi
@iloveitaly
iloveitaly / github-copilot-cli.zsh
Last active August 30, 2023 14:26
zinit plugin for github-copilot-cli
# make sure you execute this *after* asdf or other version managers are loaded
if (( $+commands[github-copilot-cli] )); then
eval "$(github-copilot-cli alias -- "$0")"
fi
@iloveitaly
iloveitaly / hide_and_quit_apps.sh
Created January 6, 2023 23:09
Hide and quit macOS applications in bash/zsh using AppleScript via osascript
function quit_apps() {
for app in $@; do
echo "Quitting $app..."
osascript -e "with timeout of 30 seconds
quit app \"$app\"
end timeout"
if [ $? -ne 0 ]; then
# if the application did not quit on it's own, let's force it!
@iloveitaly
iloveitaly / fidelity_charitable_export.js
Created July 23, 2022 21:53
Download all PDFs for contributions in fidelity charitable by copy & pasting this into your browser
$x("//a[contains(@href, \"fc-services/api/v1/document/download\")]").forEach(el => { el.download = el.text.replace("(PDF)", "").replace("/", "-") + ".pdf"; var e = document.createEvent('MouseEvents'); e.initEvent('click' ,true ,true); el.dispatchEvent(e);})
# https://stripe.com/docs/currencies#zero-decimal
ZERO_DECIMAL_CURRENCIES = %w(
BIF
CLP
DJF
GNF
JPY
KMF
KRW
MGA
# Description: Example of using custom line item taxes in Stripe & NetSuite
Stripe.api_key = ENV['STRIPE_KEY']
customer = Stripe::Customer.create
Stripe::InvoiceItem.create(
customer: customer.id,
description: 'A great product',
amount: 10_00,
# Mike Bianco <mike@suitesync.io>
# Description: Connect Stripe coupons to existing NetSuite discount items
# Usage: map_stripe_coupons_to_netsuite.rb mapping.csv
# Link: https://gist.github.com/iloveitaly/eed7602d055d5402dd34d0ba79de6ca2
require 'stripe'
require 'csv'
Stripe.api_key = ENV['STRIPE_KEY']
// Link: https://gist.github.com/iloveitaly/0e6d012d8dffa2444e0b36c0ec7b5781
define([ 'N/search', 'N/record', 'N/runtime', 'N/error', 'N/https' ],
function(search, record, runtime, error, https) {
var STRIPE_KEY = 'sk_test_123';
var STRIPE_ENDPOINT = 'https://api.stripe.com/v1/';
function afterSubmit(context) {
if(context.type !== context.UserEventType.UPDATE) {