db.myRecords.findAndModify(
{
_id: recordId,
itemArray: {$not: { $elemMatch: { itemId: newItem.id } }}
},
{
$push: {itemArray: newItem}
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
module.exports = { | |
'env': { | |
'browser': true, | |
'es2021': true | |
}, | |
'extends': [ | |
// "standard-with-typescript", | |
'eslint:recommended', | |
'plugin:react/recommended', | |
'plugin:import/errors', |
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 -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
brew install fzf node raycast obsidian bitwarden zsh iterm2 localstack slack orbstack autojump bat the_silver_searcher jq go python vim netnewswire keycastr awscli redisinsight keybase obs insomnium grammarly-desktop vscodium git neteasemusic fortune httpie iterm2 zed marta vlc starship | |
# hold keys should repeat it in the app | |
# defaults domains | grep codium | |
defaults write com.vscodium ApplePressAndHoldEnabled -bool false |
basic concept to read: https://www.dynamodbguide.com/
Also, as MongoDB is much more flexible about indices than DDB, it's less dangerous to try out STD in MongoDB.
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
async function streamToString(stream) { | |
return await new Promise((resolve, reject) => { | |
const chunks = []; | |
stream.on('data', (chunk) => chunks.push(chunk)); | |
stream.on('error', reject); | |
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8'))); | |
}); | |
} |
you have docker installed on your system, you want to install the services we use for API project
$ docker run -d --name mongo4.4 -p 27017:27017 mongo:4.4
$ docker run -d --name rabbitmq -p 4369:4369 -p 5671-5672:5671-5672 -p 15671-15672:15671-15672 -p 15691-15692:15691-15692 -p 25672:25672 rabbitmq:3.8-management-alpine
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
# put setup script here | |
# - create default config file | |
# - etc | |
echo "########################" | |
echo "## setting up project ##" | |
echo "########################" | |
echo | |
echo |
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 { pipeline: pipelineAsCallback, Transform, Readable } = require('stream'); | |
const { promisify } = require('util'); | |
const pipeline = promisify(pipelineAsCallback); | |
const debugStream = new Transform({ | |
objectMode: true, | |
transform(chunk, encoding, callback) { | |
console.log('chunk'); | |
console.log(JSON.stringify(chunk, null, 2)); |
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
plus(1, 2) // this won't complain, as add() is hoisted | |
minus(2, 1) // this will complain, as minus is defined later | |
// expression | |
function plus(x, y) { | |
return x + y; | |
} | |
// declaration | |
const minus = function (x, y) { |
NewerOlder