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
class String | |
def valid_json? | |
begin | |
JSON.parse(self) | |
return true | |
rescue Exception => e | |
return false | |
end | |
end | |
end |
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 | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` or `git checkout` if a specified file was changed | |
# Run `chmod +x post-checkout` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id HEAD@{1} HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && echo " * changes detected in $1" && echo " * running $2" && eval "$2" |
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
git log --pretty='format:%B' master.. | |
| egrep -o "PROJ-[[:digit:]]{1,}" | |
| sort | |
| uniq | |
| xargs -I % sh -c 'curl -u $JIRA_AUTH -H "Content-Type: application/json" https://yourjira.atlassian.net/rest/api/2/issue/%' | |
| jq -r '[.key, .fields.issuetype.name, .fields.assignee.displayName, .fields.status.name, .fields.summary] | "\(.[0]): (\(.[1]), \(.[3])) \(.[4]) | \(.[2])"' | |
# output: | |
# | |
# PROJ-1234: (Story, Done) The summary of the ticket | Assignee Name |
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
#!/bin/sh | |
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig) | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');") | |
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ] | |
then | |
>&2 echo 'ERROR: Invalid installer signature' | |
rm composer-setup.php |