Skip to content

Instantly share code, notes, and snippets.

View ANUPAMCHAUDHARY1117's full-sized avatar

Anupam Chaudhary ANUPAMCHAUDHARY1117

View GitHub Profile
class Player {
constructor(name){
this.name = name;
this.goalsScored = 0;
this.chances = 10;
}
hit(){
if(this.chances === 0){
return console.log("Game is over");
const onHit = (state) => ({
hit : () => {
if(state.chances === 0){
return console.log("Game is over");
}
state.chances -= 1;
state.goalsScored += 1;
}
});
class Player {
constructor(name){
this.name = name;
this.goalsScored = 0;
this.chances = 10;
}
hit(){
if(this.chances === 0){
return console.log("Game is over");
const onHit = (state) => ({
hit : () => {
if(state.chances === 0){
return console.log("Game is over");
}
state.chances -= 1;
state.goalsScored += 1;
}
});
const onHit = (state) => ({
hit : () => {
if(state.chances === 0){
return console.log("Game is over");
}
state.chances -= 1;
state.goalsScored += 1;
}
});
const request = require("request");
function getTheUrl(data) {
var options = {
url: "https://jsonplaceholder.typicode.com/posts/" + data
}
return options
}
function consoleTheResult(url) {
function addZeroToString(str1, str2){
while (str1.length > str2.length) {
str2 = "0" + str2;
}
return str2;
}
function addTwoBugNumbers(a, b) {
if (a.length > b.length) {
b = addZeroToString(a,b);
const jwt = require('jsonwebtoken');
const jwtOperation = {
sign: function(id) {
return jwt.sign({ id }, process.env.SECRET_KEY, {
expiresIn: 864,
});
},
verify: function(token) {
return jwt.verify(token, process.env.SECRET_KEY, function(err, decoded) {
const cookieParser = require('cookie-parser');
const jwt = require('jwt');
app.get('/checkLogin', (req, res) => {
const token = cookieParser.signedCookie(req.signedCookies['x-access-token'], process.env.COOKIE_SECRET_KEY);
jwt.verify(token, process.env.SECRET_KEY, function (err, decoded) {
if (err) {
throw new Error(err);
}
return res.status(200).json({ message: 'JWT VERFIED' });
import React, { useState, useEffect, Suspense } from 'react';
import imageFile from './img_avatar.png';
import './list.css';
const ImageComponent = React.lazy(() => import('../image/image'));
const List = () => {
const [listItems, setListItems] = useState([]);
const [isFetching, setIsFetching] = useState(false);
const [page, setPage] = useState(1);