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
// 2024 version | |
const arr = Array.from({ length: 30 }, (_, id) => ({ | |
id, | |
name: `item-${id}` | |
})); | |
// 2018 version | |
const arr = Array.from(Array(30), (_, id) => ({ | |
id, | |
name: `item-${id}` |
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
const rnb = (max, min) => Math.floor(Math.random() * (max - min + 1)) + min; | |
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
const replicateObject = (obj, times) => { | |
const tmp = JSON.stringify(obj); | |
return JSON.parse("[" + tmp.concat(",").repeat(times).slice(0, -1) + "]"); | |
}; | |
const example = { | |
n: 10, | |
prop1: "My Name", | |
prop2: "My Other Name" | |
}; |
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
-- https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html | |
DROP FUNCTION db.hello; | |
CREATE FUNCTION db.hello (s CHAR(20)) | |
RETURNS CHAR(50) DETERMINISTIC | |
RETURN CONCAT('Hello, ',s,'!'); | |
SELECT db.hello('eae') | |
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/bash | |
while read -r branch; | |
do echo "deleting: $branch"; | |
git branch -D $branch; | |
done <<< `git branch | grep 'bugfix'` |
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
const url2JSON = source => { | |
const obj = { | |
source, | |
props: {}, | |
keysList: [], | |
valuesList: [] | |
}; | |
const arr = source.split('?'); |
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
# PORT=8000 | |
python -m SimpleHTTPServer 8000 # $PORT |
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
export const isAFunction = (e: unknown) => e && typeof e === "function"; | |
export interface GenericObject { | |
[key: string]: unknown; | |
} | |
export type ExecutedPromiseResponse<R> = [ | |
data: R | null, | |
error: GenericObject | null | |
]; |
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
# bash | |
python -m http.server 9000 --directory . |
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/bash | |
# Branch Removing Tool | |
LIST=$(cat ./list.txt) | |
while read -r item; do | |
echo "Current item: $item" | |
done <<<"$LIST" | |
printf "> All done. Goodbye. \n\n" | |
exit |
OlderNewer