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 maxBy from 'lodash/maxBy'; | |
import {remove as removeDiacritics} from 'diacritics'; | |
function prepareString(string) { | |
return removeDiacritics(string.toLowerCase()); | |
} | |
export function compareStrings(value, ...solutions) { | |
const results = solutions.map(solution => { | |
let matches = 0; |
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
export function getStreak(answers) { | |
let streak = 0; | |
for (const answer of answers) { | |
if (!answer.correct) { | |
break; | |
} | |
streak++; | |
} | |
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
<html> | |
<head> | |
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600" rel="stylesheet"> | |
</head> | |
<body style="margin: 0"> | |
<table cellpadding="0" cellspacing="0" width="600" style="font-family: 'Source Sans Pro', Helvetica, sans-serif; font-size: 15px; color: #191C23; margin: 0 auto;"> | |
<tr> | |
<td style="background: #3F20BA; color: white; padding: 45px; padding-bottom: 36px; text-align: center;"> | |
<img width="125" src="https://i.imgur.com/B68dwyf.png" alt="Apollo logo" /> | |
<h2 style="font-weight: 300; margin: 0; margin-top: 25px; line-height: 1.3;">We're hosting the following events in May to help you get the most out of GraphQL and Apollo.</h2> |
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 visit = require('unist-util-visit'); | |
const babel = require('@babel/core'); | |
const ts = ['ts', 'tsx', 'typescript']; | |
const babelOptions = { | |
presets: [ | |
[ | |
'@babel/typescript', | |
{ | |
allExtensions: true, |
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 ProductsList() { | |
const {loading, error, data} = useQuery(LIST_PRODUCTS); | |
if (loading) return 'Loading...'; | |
if (error) return error.message; | |
return ( | |
<ul> | |
{data.products.map(product => ( | |
<li key={product.id}>{product.name}</li> | |
))} | |
</ul> |
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 spellingBeeSolutions(wordList, puzzles) { | |
return puzzles.map(puzzle => { | |
const puzzleLetters = puzzle.split(''); | |
return wordList.reduce((acc, word) => { | |
const letters = word.split(''); | |
const match = letters.every( | |
letter => puzzleLetters.includes(letter) | |
); |
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
module.exports = { | |
plugins: [ | |
{ | |
resolve: 'gatsby-theme-esports', | |
options: { | |
root: __dirname | |
} | |
} | |
] | |
}; |
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
useEffect(() => { | |
document.addEventListener('keydown', handleKeyDown); | |
return () => { | |
document.removeEventListener('keydown', handleKeyDown); | |
}; | |
}, []); | |
function handleKeyDown(event) { | |
console.log(event); | |
} |