This file contains hidden or 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
#!/bin/bash | |
# | |
# generate-github-references | |
# | |
[[ ! -d '.git' ]] && { echo 'not in a git directory' >&2; exit 1; } | |
term="$term" | |
name="$name" | |
username="$username" | |
organization="$organization" |
This file contains hidden or 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
#!/bin/bash | |
version="$1" | |
[[ -z "$version" ]] && { echo "no version provided" >&2; exit 1; } | |
semver_regexp='^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-([0-9A-Za-z]*)(\.([0-9A-Za-z]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-])*)?$' | |
[[ ! "$version" =~ $semver_regexp ]] && { echo "$version is not valid" >&2; exit 1; } |
This file contains hidden or 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
#!/bin/bash | |
working_dir='gulp-babel-register-namespace-issue-scratchpad'; | |
mkdir -p "$working_dir"; | |
cd "$working_dir"; | |
cat << EOF >> package.json | |
{ | |
"name": "gulp-babel-register-namespace-issue-scratchpad", |
This file contains hidden or 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
#!/bin/bash | |
# Group cat Heredoc with {} | |
{ cat << EOF > 'test.txt' | |
Testing 1 2 3 | |
EOF | |
} || { # { must be on a new line. | |
# Do something else | |
} |
This file contains hidden or 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
#!/bin/bash | |
:( ){ :|:& }:; |
This file contains hidden or 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
#!/bin/bash | |
# Read secret string | |
read_secret() { | |
# Disable echo. | |
stty -echo | |
# Set up trap to ensure echo is enabled before exiting if the script | |
# is terminated while echo is disabled. | |
trap 'stty echo' EXIT |
This file contains hidden or 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
#!/bin/bash | |
# $(cd $(dirname "$0"); pwd -P) finds the scripts path; | |
# | |
# /../ Is the path of the script relative to the project root | |
# | |
# realpath normalizes the path | |
export project_root=$(realpath $(cd $(dirname "$0"); pwd -P)/../); |
This file contains hidden or 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
#!/bin/bash | |
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" | |
echo "$SCRIPTPATH"; |
This file contains hidden or 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
#!/bin/bash | |
flag_with_value=''; | |
flag_without_value=''; | |
while [[ "$#" -gt 0 ]]; | |
do | |
arg="$1"; | |
val="$2"; | |
case "$arg" in |
This file contains hidden or 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
package main | |
import ( | |
"errors" | |
"fmt" | |
"os" | |
) | |
func handle(err error) { | |
if err == nil { |
NewerOlder