This file contains 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 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 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 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 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
<script src="http://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.1/processing-api.min.js"></script><html> | |
<!-- | |
Created using jsbin.com | |
Source can be edited via http://jsbin.com/pdfjs-helloworld-v2/8598/edit | |
--> | |
<body> | |
<canvas id="the-canvas" style="border:1px solid black"></canvas> | |
<input id='pdf' type='file'/> | |
<!-- Use latest PDF.js build from Github --> |
This file contains 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 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 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 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 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