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
/** | |
* paste in the browser console and hit enter | |
*/ | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutationRecord) { | |
window.onChangeProgressBar( | |
+mutationRecord.target.style.transform.split('.')[0].replace(/\D/gim, '') | |
); | |
}); |
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
# First, you must get the previous commit sha, the one before the forced push: | |
## Hit through terminal | |
curl -u <username> https://api.github.com/repos/:owner/:repo/events | |
# Then you can create a branch from this sha: | |
## Hit through terminal | |
curl -u <github-username> -X POST -d '{"ref":"refs/heads/<new-branch-name>", "sha":"<sha-from-step-1>"}' https://api.github.com/repos/:owner/:repo/git/refs |
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
.ui-flex { | |
display: flex; | |
flex-wrap: wrap; | |
flex: 0 1 auto; | |
flex-basis: 100%; | |
max-width: 100%; | |
max-height: max-content; | |
&.full { | |
width: 100%; |
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
export type NullableToPartial<T> = T extends { [K: string]: any } | |
? { | |
[K in keyof ({ | |
[K in NullableKeys<T>]?: T[K]; | |
} & { | |
[K in RequiredKeys<T>]-?: T[K]; | |
})]: ({ | |
[K in NullableKeys<T>]?: T[K]; | |
} & { | |
[K in RequiredKeys<T>]-?: T[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
const userSchema = createSchema({ | |
name: 'string?', | |
age: 'int', | |
gender: ['f', 'm', 'o'], | |
address: { | |
type: 'schema', | |
def: { | |
name: 'string', | |
number: [['float', 'string']], | |
}, |
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 cx from 'classnames'; | |
import { createType, Infer, tuple, tupleNum } from 'backland'; | |
export const ViewportSizeEnum = tuple('xs', 'sm', 'md', 'lg', 'xl'); | |
export const ViewportSizes = Object.values(ViewportSizeEnum); | |
export type ViewportSize = typeof ViewportSizes[number]; | |
export const ViewportSizeType = createType('ViewportSize', { | |
enum: ViewportSizes, | |
optional: true, |
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
tsc --diagnostics' > './logs/diagnostics-$(date +%Y%m%d%H%M%S).log' | |
# option found on https://rocksthinkpoorly.com/guide/2021/06/01/debug-tsc-builds.html#diagnostics |
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
# will run after npm install | |
function npm() { | |
if [[ $1 == "install" ]]; then | |
command npm "$@" | |
# Creates a .nosync file in all directories that start with a dot or are named node_modules | |
find . -mindepth 1 -maxdepth 1 -type d \( -name ".*" -o -name "node_modules" \) ! -name ".git" -exec touch {}/.nosync \; -exec echo "File .nosync created in {}" \; | |
else | |
command npm "$@" | |
fi | |
} |
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
function createWorker(items: string[]) { | |
const code = makeCode(JSON.stringify(items)); | |
const blob = new Blob(code, { | |
type: 'text/javascript', | |
}); | |
const blobUrl = URL.createObjectURL(blob); | |
const worker = new Worker(blobUrl); |
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/sh | |
git add . | |
COMMIT_SUCCESS=false | |
if git commit -m 'temp'; then | |
COMMIT_SUCCESS=true | |
fi | |
git clean -fdx | |
if [ "$COMMIT_SUCCESS" = true ]; then | |
git reset --soft HEAD~1 |