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
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
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
// 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}` |
NewerOlder