Skip to content

Instantly share code, notes, and snippets.

View amiralitaheri's full-sized avatar
🙃
Confused

Seyed Amirali Taheri amiralitaheri

🙃
Confused
View GitHub Profile
const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
/**
* This function gets a async function and in case of error, it retries it
*
* @async
* @function retry
* @param {function} func - The async function
* @param {object} options - Retry options
* @param {Array} [options.args] - An array containing `func` arguments
@amiralitaheri
amiralitaheri / branch_cleaner.sh
Last active June 5, 2021 18:03
Bash script to delete branches that are merged and stale
#!/usr/bin/env bash
# List of branches that never should be deleted
protected_branches=('v1.7' 'develop' 'master')
echo "Fetching all from remote to ensure everything is up to date..."
git fetch --all
expiration_date=$(date --date="7 days ago")