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 mapParallel: IAsyncMapper = async (items, mapper) => | |
Promise.all(items.map(mapper)) | |
export const mapSequentially: IAsyncMapper = async (items, mapper) => { | |
type U = Awaited<ReturnType<typeof mapper>> | |
const results: U[] = [] | |
for (const [idx, item] of Object.entries(items)) { | |
const result = await mapper(item, Number(idx)) | |
results.push(result) | |
} |
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
git clone --bare https://gitlab.com/gpynes/cfg.git $HOME/.cfg | |
function cfg { | |
/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@ | |
} | |
mkdir -p .config-backup | |
cfg checkout | |
if [ $? = 0 ]; then | |
echo "Checked out config."; | |
else |
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
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": true, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
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 { createServer } = require('http') | |
const port = process.env.PORT || 3000 | |
const httpServerRequestHandler = (request, response) => { | |
// Logs the method and url of the incoming request | |
console.log(request.method, '=>', request.url) | |
// Writes 'Hello World' into our response stream | |
response.write('Hello World') | |
// Sends the response back to the client | |
response.end() |