Skip to content

Instantly share code, notes, and snippets.

View john-humi's full-sized avatar
🚢

John Needham john-humi

🚢
View GitHub Profile
@john-humi
john-humi / design-mode.md
Last active February 9, 2022 17:32
Design Mode Bookmark

Add this as a bookmark in your browser:

javascript:(function()%7Bdocument.designMode%20%3D%20document.designMode%20%3D%3D%3D%20'on'%20%3F%20'off'%20%3A%20'on'%7D)()
@john-humi
john-humi / bookmartlet.js
Created June 15, 2021 19:31
Google Meet FullScreen
javascript:(function()%7Bjavascript%3A (function() %7B%0A%0A let cleanFsBtns %3D () %3D> Array.from(document.getElementsByClassName('clickerMethodHandler')).forEach(e %3D> e.remove())%3B%0A%0A let clickerMethodHandle %3D function(video) %7B%0A let btn %3D document.createElement("span")%3B%0A btn.setAttribute('class'%2C 'clickerMethodHandler')%3B%0A btn.setAttribute('style'%2C "z-index%3A 999999999%3Bbackground%3A white%3Bwidth%3A 28px%3Bheight%3A 28px%3Bcontent%3A 'x'%3Bposition%3A absolute%3Bdisplay%3A block%3Bborder-radius%3A 14px%3Bmargin%3A 8px%3Bbackground-image%3A url('data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCI%2BDQogIDx0aXRsZT4NCiAgICBmdWxsc2NyZWVuDQogIDwvdGl0bGU%2BDQogIDxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTEgMXY2aDJWM2g0VjFIMXptMiAxMkgxdjZoNnYtMkgzdi00em0xNCA0aC00djJoNnYtNmgtMnY0em0wLTE2aC00djJoNHY0aDJWMWgtMnoiLz4NCjw
#!/bin/sh
# Checks if current branch matches JIRA pattern (ABC-1234-anything), then adds ABC-1234 to start of commit message.
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *')
REGEX='^([a-zA-Z]{3}-[0-9]+)-*'
if [ -n "$BRANCH_NAME" ]; then
[[ $BRANCH_NAME =~ $REGEX ]]
@john-humi
john-humi / README.md
Last active March 25, 2020 00:12
Add jira ticket to start of commit message

Adds a JIRA ticket number to Commit Message - taken from branch name

  1. Add script above to: .git/hooks/prepare-commit-msg
  2. Make executable chmod +x .git/hooks/prepare-commit-msg.

Any branch with names using JIRA ticket ids like ABC-1234-anything or DEF-234, will have the JIRA identifier prepended to commit messages.

@john-humi
john-humi / pre-commit
Last active March 6, 2020 20:54
Execute Prettier pre-commit
#!/bin/sh
# husky...
FILES=$(git diff --cached --name-only --diff-filter=ACMR "*.js" "*.ts" | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0
# Prettify all selected filesi
LINES=$(wc -l <<< $FILES | tr -d '[:space:]')
echo "Running prettier on $LINES files"
echo "$FILES" | xargs prettier --write --config ./package.json