Skip to content

Instantly share code, notes, and snippets.

import { useCallback, useEffect, useMemo, useState } from 'react'
function Info({ blue, red }: any) {
useMemo(() => getBlue(blue), [blue])
useMemo(() => getRed(red), [red])
// getBlue(blue)
// getRed(red)
return (
<div>
<p>blue {blue}</p>
const jsonIgnore = require('json-ignore');
const objectToProcess = {
field1: 'field1',
field2: 'field2',
fieldToRemove: 'hihi'
}
const result = jsonIgnore(['fieldToRemove'], objectToProcess);
app.get('/auth/example',
passport.authenticate('oauth2'));
app.get('/auth/example/callback',
passport.authenticate('oauth2', { failureRedirect: '/login' }),
function(req, res) {
// Successful authentication, redirect home.
res.redirect('/');
});
passport.use(new OAuth2Strategy({
authorizationURL: 'https://www.example.com/oauth2/authorize',
tokenURL: 'https://www.example.com/oauth2/token',
clientID: EXAMPLE_CLIENT_ID,
clientSecret: EXAMPLE_CLIENT_SECRET,
callbackURL: "http://localhost:3000/auth/example/callback"
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ exampleId: profile.id }, function (err, user) {
return cb(err, user);
passport.use(new OAuth2Strategy({
authorizationURL: 'https://www.example.com/oauth2/authorize',
tokenURL: 'https://www.example.com/oauth2/token',
clientID: EXAMPLE_CLIENT_ID,
clientSecret: EXAMPLE_CLIENT_SECRET,
callbackURL: "http://localhost:3000/auth/example/callback"
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ exampleId: profile.id }, function (err, user) {
return cb(err, user);
version: '3'
services:
config:
build:
context: .
ports:
- "8000:8000"
command:
"python manage.py runserver 0.0.0.0:8000"
for await (const value of arr) {
await mongoDataDao.insertOne({ value: value }, 'temp', 'number', mongoClient);
}
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useGlobalPipes(new ValidationPipe());
await app.listen(3000);
}
bootstrap();
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useGlobalPipes(new ValidationPipe());
await app.listen(3000);
}
bootstrap();
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useGlobalPipes(new ValidationPipe());
await app.listen(3000);
}
bootstrap();