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
import { useEffect, useState } from 'react' | |
type ReturnType = { | |
setRef: (elm: Element | null) => void | |
done: boolean | |
} | |
export const useIntersection = (): ReturnType => { | |
const [element, setElement] = useState<Element | null>(null) | |
const [done, setDone] = useState(false) |
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
TIMEOUT_UNIXTIME="$(($(date +%s)+10))" | |
while [ "$(date +%s)" -lt "$TIMEOUT_UNIXTIME" ]; do | |
echo test | |
done | |
# bash | |
$TIMEOUT_SECONDS=$((SECONDS+10)) | |
while [ $SECONDS -lt $TIMEOUT_SECONDS ]; do | |
echo test | |
done |
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
seq 10 | while read; do | |
echo "close local variable" | |
done | |
# bash | |
<<(seq 10) while read; do | |
echo "open variable" | |
done |
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 -eu | |
# ## Post bundle analyzer to github statuses | |
# | |
# ### Environment Variables | |
# | |
# - `REPORT_JSON_PATH`: By webpack-bundle-analyzer | |
# - `REPORT_HTML_PATH`: By webpack-bundle-analyzer | |
# - `GITHUB_TOKEN`: GitHub Access Token | |
# - `CIRCLE_SHA1`: Defined by CircleCI |
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
GITHUB_PR_NUMBER=1234 | |
base_branch_sha1() { | |
MERGED_BRANCH="pull/${GITHUB_PR_NUMBER}/merge" | |
git fetch origin "${MERGED_BRANCH}:${MERGED_BRANCH}" > /dev/null | |
git log "${MERGED_BRANCH}" --oneline | head -n1 | sed -e 's/^.* into //' | |
} |
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 -eu | |
# | |
# Testcafe report of json to xunit for split by timings on CircleCI | |
# | |
# refs. | |
# https://github.com/DevExpress/testcafe-reporter-xunit | |
# https://github.com/DevExpress/testcafe-reporter-json | |
# | |
# required packages: | |
# base64 |
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 -eu | |
# | |
# required env: | |
# GITHUB_ACCESS_TOKEN | |
# GITHUB_PROJECT_ID | |
# GITHUB_PROJECT_SETTING_CARD_ID | |
# SLACK_INCOMING_WEBHOOK_URL | |
# | |
# required packages: | |
# base64 |
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 -eu | |
# | |
# required env: | |
# SLACK_TEXT: Description, Build URL of CI | |
# SLACK_INCOMING: Slack Incoming Webhook URL | |
# | |
# required stdin: | |
# json text of `.data.advisory` on yarn audit | |
# | |
# required packages: |
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 -eu | |
# | |
# required env: | |
# WAFFLE_ACCESS_TOKEN | |
# WAFFLE_ORG_NAME | |
# WAFFLE_PROJECT_NAME | |
# | |
# required packages: | |
# base64 | |
# curl |
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 -eu | |
# Usage: hunho2markdown.sh <2010-01-02> | |
# required: export SLACK_TOKEN="(e.g. https://api.slack.com/custom-integrations/legacy-tokens)" | |
# required: brew install pandoc | |
date="${1:-undefined}" | |
# slack variables | |
slack_domain="${SLACK_DOMAIN:-f**df****e}" # ****.slack.com | |
slack_userid="${SLACK_USERID:-U********}" |
NewerOlder