Skip to content

Instantly share code, notes, and snippets.

View stfsy's full-sized avatar
🎯
Focusing

Stefan Pfaffel stfsy

🎯
Focusing
View GitHub Profile
{
"title": "users",
"bsonType": "object",
"required": [
"id",
"name",
"email"
],
"properties": {
"id": {
var ClientSideFieldLevelEncryptionOptions = {
"keyVaultNamespace": "encryption.__keys",
"kmsProviders": {
"local": {
"key": BinData(0, "${encryption_master_key}")
}
}
}
var connection = new Mongo(
@stfsy
stfsy / mongodb-connection.js
Created October 1, 2020 13:26
Example for connecting to MongoDB instance and enable chema validation for a collection
'use strict'
const Mongo = require('mongodb').MongoClient
const configuration = require('../configuration/configuration')
const mongoUrl = configuration.getMongoDbUrl()
const mongoDbName = configuration.getMongoDbName()
module.exports = class {
'use strict'
const Connector = require('./mongodb-connection')
const uuid = require('uuid').v4
const USERS_COLLECTION = "users"
module.exports = new class extends Connector {
constructor() {
'use strict'
const { expect } = require('chai')
const users = require('../../../lib/repository/users')
describe('Users', () => {
after(() => {
return users._close()
})
describe('.getUser', () => {
version: '3.1'
services:
mongo:
image: mongo
restart: always
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: user
import json
from pathlib import Path
import pymongo
mongoClient = pymongo.MongoClient(
"mongodb://localhost:27017/", username="removed", password="removed")
mongoDatabase = mongoClient["twitter"]
mongoCollection = mongoDatabase["tweets"]
import pymongo
mongoClient = pymongo.MongoClient(
"mongodb://localhost:27017/", username="removed", password="removed")
mongoDatabase = mongoClient["twitter"]
mongoCollection = mongoDatabase["tweets"]
def fetch_next_tweet_without_classification():
result = list(mongoCollection.aggregate([
{
@stfsy
stfsy / _repositories.txt
Last active January 30, 2021 20:19
How to move your JavaScript Build from Travis CI to Github Actions in 3 Steps
node-html-light
node-modules-scan
broccoli-plugin-adapter
broccoli-test-runner
broccoli-livereload
broccoli-image-min
broccoli-inject-livereload
broccoli-version
express-cloudfoundry-actuator-middleware
generator-stfsy-node
const observer = new IntersectionObserver((entries, observer) => {
for (const entry of entries) {
if (entry.isIntersecting) {
// do something after target has become visible on screen
} else {
// do something after target has been moved off screen
}
}
}, options)