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
window.addEventListener('focusin',() => { | |
console.log(document.activeElement) | |
}) |
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
#! /usr/bin/env node | |
const glob = require("glob"); | |
const sharp = require("sharp"); | |
glob("./data/**/*.+(jpeg|png)", (err, files) => { | |
Promise.allSettled( | |
files.map((file) => { | |
const link = file.split("/"); | |
link.pop(); | |
const newFile = `${link.join("/")}/main.jpeg`; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<link rel="stylesheet" href="./style.css"> | |
<title>Adopt Me</title> | |
</head> |
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, useReducer } from 'react'; | |
import { | |
Form as FormikForm, | |
Formik, | |
Field, | |
FieldProps, | |
ErrorMessage, | |
} from 'formik'; | |
import { Form, Upload, Button, Icon, AutoComplete } from 'antd'; | |
import SimpleError from './SimpleError'; |
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 collection = [ | |
{ name: 'samundra', rank: 3 }, | |
{ name: 'abina', rank: 5 }, | |
{ name: 'hari', rank: 1 }, | |
{ name: 'bibek', rank: 2 }, | |
{ name: 'suman', rank: 4 }, | |
]; | |
function sortBy(collection, compareBy) { | |
return collection.sort((item, lastItem) => { |
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 flat(arr, carryOverArray = []) { | |
arr.forEach(element => { | |
if (Array.isArray(element)) { | |
flat(element, carryOverArray); | |
} else { | |
carryOverArray.push(element); | |
} | |
}); | |
return carryOverArray; | |
} |
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 insertInArray(string, index, arr) { | |
const sliceBefore = arr.slice(0, index); | |
const sliceAfter = arr.slice(index, arr.length); | |
return sliceBefore.concat([string], sliceAfter); | |
} | |
function differ(arr1, arr2) { | |
const diff = []; | |
arr2.forEach((element, index) => { |
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 'cross-fetch/polyfill'; | |
import ApolloClient, { gql } from 'apollo-boost'; | |
import 'dotenv/config'; | |
const client = new ApolloClient({ | |
uri: 'https://api.github.com/graphql', | |
request: operation => { | |
operation.setContext({ | |
headers: { | |
authorization: `Bearer ${process.env.GITHUB_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 a = [ | |
{ id: 3, name: 'Matt' }, | |
{ id: 4, name: 'Greg' }, | |
{ id: 1, name: 'David' }, | |
{ id: 2, name: 'John' }, | |
]; | |
const b = [ | |
{ id: 7, position: 'Outlier' }, | |
{ id: 2, position: 'Leader' }, | |
{ id: 3, position: 'Captain' }, |
NewerOlder