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 | |
FILE=$1 | |
MESSAGE=$(cat $FILE) | |
TICKET=[$(git rev-parse --abbrev-ref HEAD | grep -Eo '^(\w+/)?(\w+[-_])?\d+' | grep -Eo '(\w+[-])?\d+' | tr "[:lower:]" "[:upper:]")] | |
if [[ $TICKET == "[]" || "$MESSAGE" == "$TICKET"* ]];then | |
exit 0; | |
fi | |
echo "$TICKET $MESSAGE" > $FILE |
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 | |
FILE=$1 | |
MESSAGE=$(cat $FILE) | |
TICKET=$(git rev-parse --abbrev-ref HEAD | sed -E 's/([a-z]+\/)?([a-z]+-[0-9]+).*/[\2]/' | tr "[:lower:]" "[:upper:]" | grep -Eo '^\[([A-Z]+-)?\d+/]$') | |
if [[ "$MESSAGE" == "$TICKET"* ]];then | |
exit 0; | |
fi | |
echo "$TICKET $MESSAGE" > $FILE |
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
!(a != b || c != d) == (a == b && c == d) | |
!(a >= b && c <= d) == (a < b || c > d) |
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
!(!a || !b) == (!!a && !!b) == (a && b); | |
!(!a && !b) == (!!a || !!b) == (a || b); | |
/* Double negation returns the variable itself */ |
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
import { createContext } from './hotkeys'; | |
const c = createContext(); | |
// Alerts when "no way" is typed in. | |
c.register('n o space w a y', () => { | |
alert('Yes way!'); | |
}); | |
/* |
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
const isEqual = (a, b) => { | |
const aKeys = Object.keys(a); | |
if (aKeys.length !== Object.keys(b).length) { | |
return false; | |
} | |
return aKeys.every( | |
(k) => Object.prototype.hasOwnProperty.call(b, k) | |
&& a[k] === b[k], |
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
'use strict'; | |
const isEqual = (buff, hotkey) => { | |
const buffKeys = Object.keys(buff); | |
if (buffKeys.length !== Object.keys(hotkey).length) { | |
return false; | |
} | |
return buffKeys.every( | |
(k) => hotkey.hasOwnProperty(k) && buff[k] === hotkey[k] | |
); |