This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Player { | |
| constructor(name){ | |
| this.name = name; | |
| this.goalsScored = 0; | |
| this.chances = 10; | |
| } | |
| hit(){ | |
| if(this.chances === 0){ | |
| return console.log("Game is over"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const onHit = (state) => ({ | |
| hit : () => { | |
| if(state.chances === 0){ | |
| return console.log("Game is over"); | |
| } | |
| state.chances -= 1; | |
| state.goalsScored += 1; | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Player { | |
| constructor(name){ | |
| this.name = name; | |
| this.goalsScored = 0; | |
| this.chances = 10; | |
| } | |
| hit(){ | |
| if(this.chances === 0){ | |
| return console.log("Game is over"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const onHit = (state) => ({ | |
| hit : () => { | |
| if(state.chances === 0){ | |
| return console.log("Game is over"); | |
| } | |
| state.chances -= 1; | |
| state.goalsScored += 1; | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const onHit = (state) => ({ | |
| hit : () => { | |
| if(state.chances === 0){ | |
| return console.log("Game is over"); | |
| } | |
| state.chances -= 1; | |
| state.goalsScored += 1; | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const request = require("request"); | |
| function getTheUrl(data) { | |
| var options = { | |
| url: "https://jsonplaceholder.typicode.com/posts/" + data | |
| } | |
| return options | |
| } | |
| function consoleTheResult(url) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
OlderNewer