Skip to content

Instantly share code, notes, and snippets.

@daniloab
Last active January 5, 2022 05:02
Show Gist options
  • Save daniloab/a505dc23f7386ca433e06bfc4d308196 to your computer and use it in GitHub Desktop.
Save daniloab/a505dc23f7386ca433e06bfc4d308196 to your computer and use it in GitHub Desktop.

Brew

  • list of services running
brew services list
  • mongodb-community
brew services start mongodb-community
brew services stop mongodb-community
  • redis
brew services start redis
brew services stop redis

Change folder owner

  • sudo chown -R $USER ~/.blabla

MongoDB

  • lookup
{
  $lookup: {
    from: 'NineBox',
    localField: 'nineBox',
    foreignField: '_id',
    as: 'nineBox',
  },
},
{
  $lookup: {
    from: 'NineBoxEvaluationScore',
    let: {
      nineBoxId: '$nineBox._id',
      userId: '$user',
      axisId: '$nineBox.xAxis._id',
    },
    pipeline: [
      {
        $match: {
          $expr: {
            $and: [
              { $eq: ['$user', '$$userId'] },
              { $eq: ['$nineBox', '$$nineBoxId'] },
              { $eq: ['$axis', '$$axisId'] },
            ],
          },
        },
      },
    ],
    as: 'xAxisScore',
  },
},

Remove old branches already deleted

git branch --merged | grep -v "\*" | grep -v master | xargs -n 1 git branch -D

Remove all node_modules

find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment