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
| { | |
| "title": "Arrow", | |
| "runtime": "42min", | |
| "year": "2012", | |
| "story": "Oliver Queen and his father are lost at sea when their luxury yacht sinks, apparently in a storm. His father dies, but Oliver survives for five years on an uncharted island and eventually returns home. But he wasn't alone on the island where he learned not only how to fight and survive but also of his father's corruption and unscrupulous business dealings. He returns to civilization a changed man, determined to put things right. He disguises himself with the hood of one of his mysterious island mentors, arms himself with a bow and sets about hunting down the men and women who have corrupted his city.", | |
| "creators": [ | |
| "Greg Berlanti", | |
| "Marc Guggenheim", | |
| "Andrew Kreisberg" | |
| ], |
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 { | |
| Worker, | |
| isMainThread, | |
| parentPort, | |
| workerData | |
| } = require("worker_threads"); | |
| const lib = require("./lib"); | |
| if (isMainThread) { |
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 workers = require("./woker"); | |
| workers("tt2193021") | |
| .then(console.log) | |
| .catch(console.error); |
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 getEpisode(id, season, callback) { | |
| request( | |
| `https://www.imdb.com/title/${id}/episodes/_ajax?season=${season}`, | |
| function(error, response, data) { | |
| const episodes = []; | |
| const $ = cheerio.load(data); | |
| $(".eplist > .list_item").each(function(i) { | |
| const story = $( | |
| `.eplist > div:nth-child(${i + 1}) > .info > .item_description` | |
| ) |
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 getCast(id, n, callback) { | |
| request( | |
| `https://m.imdb.com/title/${id}/fullcredits/cast?ref_=m_ttfc_3`, | |
| (error, response, data) => { | |
| const $ = cheerio.load(data); | |
| let cast = []; | |
| let i = 0; | |
| while (i < n) { | |
| try { | |
| cast.push({ |
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 from "react"; | |
| import s from "./app.component.css"; | |
| export default function App(props) { | |
| return ( | |
| <form className={s.form}> | |
| <input | |
| type="email" | |
| placeholder="Enter email" | |
| name="email" |
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, Fragment, useEffect } from "react"; | |
| import { Formik, Field } from "formik"; | |
| import s from "./app.component.css"; | |
| import * as yup from "yup"; | |
| const intialState = { | |
| name: "", | |
| email: "", | |
| password: "" | |
| }; |
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
| /** | |
| * validateToken - validate the token supplied by the frontend | |
| * @param {String} token the token supplied by the front end | |
| * @param {String} ffid the ffid of the user | |
| */ | |
| async function validateToken(token, ffid) { | |
| const data = await request.get( | |
| `https://graph.facebook.com/debug_token?input_token=${token}&access_token=${ | |
| config.FB.APP_ID | |
| }|${config.FB.APP_SECERET}` |
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
| async function loginUser(userObject, callback) { | |
| // some validation for the request body or data supplied to function | |
| const { error, value } = Joi.validate(userObject, userObjectSchema); | |
| if (error) { | |
| callback(error); | |
| } else { | |
| try { | |
| // check for validate of the access torken the code for it is given in pervious example | |
| const isTokenValid = await fbHelper.validateToken( | |
| userObject.access_token, |
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 config = require("../../config")(); | |
| module.exports = { | |
| /** | |
| * sign - create a jwt from payload. | |
| * | |
| * @param {Object} payload the payload send to the user | |
| * @param {Function} callback function envoked with two parameters | |
| * 1. error the error in operation |