Skip to content

Instantly share code, notes, and snippets.

View tkssharma's full-sized avatar
🎯
only JS

codewithtkssharma tkssharma

🎯
only JS
View GitHub Profile
# Review checklist
## General
1. Does the code work?
2. Description of the project status is included.
3. Code is easily understand.
4. Code is written following the coding standarts/guidelines (React in our case).
5. Code is in sync with existing code patterns/technologies.
6. DRY. Is the same code duplicated more than twice?
const { CognitoUserPool, CognitoUser, AuthenticationDetails } = require("amazon-cognito-identity-js");
const debug = require("debug");
const error = debug("authorizer:error:lambda");
const verbose = debug("authorizer:verbose:lambda");
// DEBUG : authorizer:*
const cognitoUserPool = () => (
new CognitoUserPool({
const { Kafka } = require('kafkajs')
// This creates a client instance that is configured to connect to the Kafka broker provided by
// the environment variable KAFKA_BOOTSTRAP_SERVER
const kafka = new Kafka({
clientId: 'qa-topic',
brokers: ['xxxxxxxxx.confluent.cloud:9092'],
ssl: true,
logLevel: 2,
sasl: {
const { startBrowser } = require("./browser");
const cheerio = require("cheerio");
async function scrapeData(url) {
const browser = await startBrowser();
const page = await browser.newPage();
await page.goto(url, { waitUntil: "networkidle0" });
await page.waitForSelector(".listResults");
const content = await page.content();
const links = await getJobData(content);
const { startBrowser } = require('./browser');
const cheerio = require('cheerio');
async function scrapeData() {
const books = [];
const browser = await startBrowser();
const page = await browser.newPage();
await page.goto('http://books.toscrape.com/', { waitUntil: 'networkidle0' })
await page.waitForSelector('.page_inner');
version: '3.5'
services:
zota_mongo:
volumes:
- mongo_data:/data/configdb
- mongo_data:/data/mysql
gateway:
volumes:
- ./proxy/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./proxy/ssl:/etc/nginx/ssl:ro
FROM node:carbon
WORKDIR /usr/src/app
ARG GIT_TOKEN
COPY package.json package-lock.json .npmrc ./
RUN npm install
RUN rm -f .npmrc
# Add your source files
COPY . .
EXPOSE 3000
RUN npm run build
version: '3.5'
services:
gateway:
image: nginx:1.11
ports:
- 88:80
- 443:443
depends_on:
- zota_car
- zota_company
version: '3.5'
services:
zota_mongo:
volumes:
- mongo_data:/data/configdb
- mongo_data:/data/mysql
gateway:
volumes:
- ./proxy/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./proxy/ssl:/etc/nginx/ssl:ro
@tkssharma
tkssharma / setstate
Created December 2, 2020 06:29 — forked from tkskumar/setstate
```
setState()
- is Asynchronous
- can have a function as a parameter instead of object
- can accepts a Callback function as a second argument (optional)
- does not return promise
```
function updateState(){
this.setState({load: true}, () => {