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
| :root { | |
| --black: rgb(13, 13, 13); | |
| --darkest-gray: rgb(24, 25, 32); | |
| --dark-gray: rgb(79, 79, 79); | |
| --medium-gray: rgb(130, 130, 130); | |
| --gray: rgb(189, 189, 189); | |
| --light-gray: rgb(224, 224, 224); | |
| --lightest-gray: rgb(242, 242, 242); | |
| --white: rgb(250, 250, 250); | |
| --purple: rgb(101, 82, 224); |
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
| // Mock data | |
| const fakePaginatedData = [ | |
| { | |
| next: 'https://fake-api.com/cars?page=2', | |
| results: [ | |
| { model: 'Volvo XC40', year: '2020', price: '30000' }, | |
| { model: 'Renault Clio', year: '2019', price: '10000' }, | |
| { model: 'Toyota Aygo', year: '2022', price: '20000' }, | |
| ], | |
| }, |
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
| // Wait utility | |
| const wait = (timeInMs) => { | |
| return new Promise((resolve) => { | |
| setTimeout(resolve, timeInMs); | |
| }); | |
| }; | |
| let i = 0; | |
| // Fake real time data stream |
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 wait = (time) => { | |
| return new Promise((resolve) => { | |
| setTimeout(resolve, time); | |
| }); | |
| }; | |
| // Fake polling data | |
| const fakeData = [null, null, null, { data: { foo: 'bar' } }]; | |
| let i = 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
| const getRandomInt = (range) => Math.floor(Math.random() * range); | |
| // Create an array of symbols for the slot machine | |
| const symbols = ['π', 'π', 'π', '7οΈβ£', 'π±']; | |
| // Define a generator function that will yield a random symbol | |
| // from the array when iterated over | |
| function* getReels(noOfReels = 3) { | |
| let i = 0; | |
| while (i++ < noOfReels) { |
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 emoji = require('emoji-name-map') | |
| // 1. Iterable object | |
| const impersonator = { | |
| genders: ['man', 'woman', 'adult'], | |
| professions: [], | |
| [Symbol.iterator]: function* () { | |
| for (const profession of this.professions) { | |
| for (const gender of this.genders) { | |
| const professional = emoji.get(gender) + '\u200d' + emoji.get(profession) |
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 getRandomInt = (range) => Math.floor(Math.random() * range); | |
| // Create an array of symbols for the slot machine | |
| const symbols = ['π', 'π', 'π', '7οΈβ£', 'π±']; | |
| // Define a generator function that will yield a random symbol | |
| // from the array when iterated over | |
| function* getReels(noOfReels = 3) { | |
| let i = 0; | |
| while (i++ < noOfReels) { |
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 categorizeValues = ([category, values]) => | |
| values.map(value => Object.fromEntries([[category, value]])) | |
| const combineCategories = (prev, curr) => | |
| curr.flatMap(currEl => prev.map(prevEl => ({...prevEl, ...currEl}))) | |
| const combinations = input => | |
| Object.entries(input).map(categorizeValues).reduce(combineCategories); | |
| /* |
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 isEmpty = word => word === ""; | |
| const isSingleChar = word => word.length === 1; | |
| const isDoubleChar = word => word.length === 2; | |
| const firstChar = word => word[0]; | |
| const lastChar = word => word.slice(-1); | |
| const isMatch = (a,b) => a === b; | |
| const trimEnds = word => word.slice(1,-1); | |
| const isEndsMatched = word => isEmpty(word) || isMatch(firstChar(word), lastChar(word)) | |
| const isPalindrome = word => { |
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 css from "./main.css"; | |
| import { createStore } from "./redux/store/index"; | |
| import { actions } from "./redux/actions/index"; | |
| import { rootReducer } from "./redux/reducers/index"; | |
| import { render } from "lit-html"; | |
| import { App } from "./templates/App"; | |
| const store = createStore(rootReducer, {}); | |
| export default () => { |
NewerOlder