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
AES | |
# Pack a folder into a tar.gz file: | |
tar -zcvf my_folder.tar.gz my_folder/ | |
# encrypt file.txt to file.enc using 256-bit AES in CBC mode | |
openssl enc -aes-256-cbc -in file.txt -out file.enc | |
# decrypt binary file.enc | |
openssl enc -d -aes-256-cbc -in file.enc -out file.txt |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Deep clone: lodash vs native</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Replacing URL known hostname to another hostname: search.replace vs parsing url</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Replacing URL known hostname to another hostname: search.replace vs parsing url</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
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
function main() { | |
const arr = [1,2,3,5,5,6,7,7,5464,43,1,4,6,7,8,6,4,2,2,2,3,4,6,6]; | |
const dedup = [...new Set(arr)]; | |
console.log(dedup); | |
} | |
setInterval(main, 10); |
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 p = new Promise((resolve) => resolve(1)); | |
p.then(r => console.log('promise', r)); | |
async function foo() { | |
const r = await p; | |
console.log('async', r); | |
} | |
foo(); |
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
function collapseAllDiff(text) { | |
document.querySelectorAll('.file-info a').forEach(el => { | |
if (el.title.indexOf(text) > -1){ | |
console.log(el.closest('.file-header').querySelectorAll('.js-details-target')[0].click()); | |
} | |
}); | |
} |
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
class Foo { | |
static bar() { | |
return 'bar'; | |
} | |
baz() { | |
return this.constructor.bar(); | |
} | |
} |
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
class CustomError { | |
get name() { | |
return 'foo'; | |
} | |
get code() { | |
return 400; | |
} | |
test() { |
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
// old-school callback hell | |
const callbackHell() = (cb) => { | |
foo1((err, result) => { | |
if (err) { | |
return cb(err); | |
} | |
foo2((err, result) => { | |
if (err) { | |
return cb(err); | |
} |