View graph.ts
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
/** | |
* References: | |
* https://adelachao.medium.com/graph-topological-sort-javascript-implementation-1cc04e10f181 | |
* http://peterknolle.com/page/51/ | |
* https://en.wikipedia.org/wiki/Topological_sorting#Depth-first_search | |
*/ | |
class Graph { | |
private vertices: Record<string, Array<string>>; |
View async-poller.ts
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
/** | |
* The function you pass to `asyncPoll` should return a promise | |
* that resolves with object that satisfies this interface. | |
* | |
* The `done` property indicates to the async poller whether to | |
* continue polling or not. | |
* | |
* When done is `true` that means you've got what you need | |
* and the poller will resolve with `data`. | |
* |
View JWT.cls
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
/** | |
* Inspired by the JWT repo by Salesforce Identity | |
* https://github.com/salesforceidentity/jwt/ | |
* | |
* Inspired by the JWT repo by Auth0 | |
* https://github.com/auth0/java-jwt | |
* | |
* Learn more about JWT at https://jwt.io | |
*/ | |
public inherited sharing class JWT { |
View create-package-version.sh
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
#!/usr/bin/env bash | |
# =========================================================================== # | |
# USAGE | |
# ----- | |
# create-package-version.sh [branchName] | |
# | |
# The $1 argument (optional) indicates the git branch to use. | |
# If not set then script defaults to 'develop' branch. | |
# =========================================================================== # |
View delete-local-branches.sh
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
# You'll need to keep one branch. | |
# Specify that branch's name here. | |
BRANCH_TO_KEEP=master | |
# Switch to the branch you're keeping | |
git checkout ${BRANCH_TO_KEEP} | |
# Delete all other local branches | |
git branch -D $(git branch | grep -v -e ${BRANCH_TO_KEEP}) |
View delete-org.sh
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
org_list_json=$(sfdx force:org:list --json) | |
scratch_org_username=$1 | |
devhub_username=$2 | |
# if no scratch org username given, use default | |
if [ -z "$1" ]; then | |
scratch_org_username=$(echo $org_list_json | jq -r '.result.scratchOrgs[] | select(.isDefaultUsername) | .signupUsername') | |
else | |
# else check if argument is an org alias and get signup username from that | |
scratch_org_username=$(echo $org_list_json | jq -r --arg ALIAS "$1" '.result.scratchOrgs[] | select(.alias==$ALIAS) | .signupUsername') |
View rename.sh
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
# Finds all files in the current directory and subdirectories | |
# whose filenames match the expression "*.js" (ends with .js) | |
# then renames the files, changing their extension to ".ts". | |
# https://stackoverflow.com/questions/7450818/rename-all-files-in-directory-from-filename-h-to-filename-half | |
for file in $(find . -type f -name "*.js") | |
do | |
mv "$file" "${file/.js/.ts}" | |
done |
View load_properties.sh
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
# Read a property file line by line and | |
# set key=value pairs as bash variables | |
# https://stackoverflow.com/a/28831442/470818 | |
FILEPATH=$1 | |
while IFS='=' read -r k v; do | |
eval ${k}=${v} | |
done < $FILEPATH |
View github-copy-labels.sh
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
# This script uses the GitHub Labels REST API | |
# https://developer.github.com/v3/issues/labels/ | |
# Provide a personal access token that can | |
# access the source and target repositories. | |
# This is how you authorize with the GitHub API. | |
# https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line | |
GH_TOKEN="YOUR_TOKEN" | |
# If you use GitHub Enterprise, change this to "https://<your_domain>/api/v3" |
View github-export-labels.js
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
/** | |
* Inspired by @MoOx original script: https://gist.github.com/MoOx/93c2853fee760f42d97f | |
* Adds file download per @micalevisk https://gist.github.com/MoOx/93c2853fee760f42d97f#gistcomment-2660220 | |
* | |
* Changes include: | |
* - Get the description from the `title` attribute instead of `aria-label` (doesn't exist anymore) | |
* - Use style.backgroundColor and parse the rgb(...) to hex (rather than regex parsing of 'style' string) | |
* - Downloads labels to a JSON file named after the webpage to know which GitHub repo they came from. | |
* | |
* Last tested 2019-July-27: |
NewerOlder