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
#! /usr/bin/env bash | |
# Replace "*" as needed | |
for d in *; do (cd $d; git push -f) &; done; wait |
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
#! /usr/bin/env bash | |
# if all subfolders are JS projects with a package.json containing repository.url field | |
# and repository.url is something like "ssh://git@server/project" or "ssh:// | |
REMOTE_PREFIX=<your git server prefix like git@server> | |
for repo in */; do | |
( | |
cd "$repo" || 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
const R = require('ramda'); | |
const mergeExistingProps = (target, updater) => { | |
const targetClone = R.clone(target); | |
for (const prop in targetClone) { | |
if (Object.prototype.hasOwnProperty.call(updater, prop)) { | |
targetClone[prop] = updater[prop]; | |
} | |
} |
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
echo '[ | |
{"a": "a", "b": "b", "c": "c"}, | |
{"a": "1", "b": "2", "c": "3"}, | |
{"a": "x", "b": "y", "c": "z"} | |
]' | jq ".[] | {b, c}" | |
# output: | |
# { | |
# "b": "b", | |
# "c": "c" |
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 testUrl = 'https://todomvc.com/examples/typescript-react/'; | |
const todos = { | |
A: ['foo', 'bar', 'baz'], | |
B: ['1', '2', '3'] | |
}; | |
const getTodos = () => cy.get('ul.todo-list li'); | |
const addTodo = (text) => cy.get('input.new-todo').type(`${text}{enter}`); |
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 replaceMultiple = (input, ...regexReplacePairs) => | |
regexReplacePairs.reduce((previous, [ regex, replace ] ) => | |
previous.replace(regex, replace), input | |
); | |
const template = '<header> \n 12345 \n <body> \n --- \n <footer>'; | |
const header = 'Welcome to my blog!'; | |
const body = 'This is the body of my post.'; | |
const footer = 'All rights reserved.'; |
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
#! /usr/bin/env bash | |
# Made to work on Mac version of `stat` | |
rm -f readme.md | |
# Static header contents go in readme.header.md | |
cat readme.header.md >> readme.md | |
mdFiles=$(find ./*/ -name \*.md) |
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
# make sure the tag is updated from remote on local | |
git fetch | |
# retag with a message | |
git tag <tag name> <tag name>^{} -f -m "<new message>" | |
# might need to add -f to force-push | |
git push <tag name> <remote> |
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
#!/usr/bin/env bash | |
# chmod +x this and save in your PATH. Assumes `prettier` is in your `devDependencies` already | |
BASE=$(git merge-base master HEAD) # change master to whatever your trunk branch is | |
FILES=$(git diff --name-only $BASE HEAD | xargs) | |
npx prettier --list-different $FILES | |
# Want eslint too? | |
# npx eslint --ignore-path=.prettierignore $FILES |
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 sizzleScript = document.createElement('script'); | |
sizzleScript.src = 'https://cdn.jsdelivr.net/npm/sizzle@latest/dist/sizzle.min.js'; | |
document.getElementsByTagName('head')[0].appendChild(sizzleScript); | |
window.sz = window.Sizzle; |
NewerOlder