Skip to content

Instantly share code, notes, and snippets.

View KevinVR's full-sized avatar
💻
Always Coding

Kevin Van Ryckegem KevinVR

💻
Always Coding
View GitHub Profile
import React, {useState} from 'react';
const LightBox = ({children, src, alt, Wrapper = 'div'}) => {
const [ isOpen, setIsOpen ] = useState(false);
const toggleIsOpen = () => {
setIsOpen(!isOpen);
};
return (
import React, {useState} from 'react';
const LightBox = ({children, src, alt, Wrapper = 'div'}) => {
const [ isOpen, setIsOpen ] = useState(false);
return (
<Wrapper>
</Wrapper>
);
import React from 'react';
const LightBox = ({children, src, alt, Wrapper = 'div'}) => {
return (
<Wrapper>
</Wrapper>
);
};
import React from 'react';
const LightBox = () => {
return (
<div>
</div>
);
};
class DB {
private _connection: MongoClient;
private _db: Db;
constructor() {}
public async connect() {
const mongoClientPromise = MongoClient.connect(process.env.MONGODB_URI, { useNewUrlParser: true, useUnifiedTopology: true });
this._connection = await mongoClientPromise;
this._db = this._connection.db(process.env.MONGODB_NAME);
}
class DB {
private _connection: AWS.DynamoDB.DocumentClient;
constructor() {
this._connection = new AWS.DynamoDB.DocumentClient();
}
}
const params = {
TableName: 'users',
FilterExpression: 'phone = :phone, email = :email',
ExpressionAttributeValues: {
phone: phoneNumber,
email: emailAddress
}
};
const result = await docClient.scan(params).promise();
const docClient = new AWS.DynamoDB.DocumentClient();
var params = {
TableName: 'users',
Key: {
"email": emailAddress,
"phone": phoneNumber
}
};
const result = await mongoClient.collection('users').findOne({
email: emailAddress,
phone: phoneNumber
});
// en.json
{
"items": [
{
title: "abc"
},
{
title: "def"
}
]