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 { CONSTS } from "../redux/actions/index.js"; | |
| const { ALL, DONE, IN_PROGRESS } = CONSTS.visibilityFilters; | |
| export const makeRegrettable = (store, actions) => ({ | |
| undo() { | |
| return store.dispatch(actions.undo()); | |
| }, | |
| redo() { | |
| return store.dispatch(actions.redo()); |
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 const getAndResetInput = (e) => { | |
| const [input] = e.target; | |
| const { value } = input; | |
| input.value = ""; | |
| return value; | |
| }; | |
| export const maybeRender = (template, validator) => | |
| validator ? template : null; |
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
| body { | |
| font: 14px "Helvetica Neue", Helvetica, Arial, sans-serif; | |
| line-height: 14px; | |
| background: #f5f5f5; | |
| color: #4d4d4d; | |
| margin: 1em; | |
| -webkit-font-smoothing: antialiased; | |
| -moz-osx-font-smoothing: grayscale; | |
| font-weight: 300; | |
| display: flex; |
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, {}); | |
| store.subscribe(() => console.log(store.getState())); |
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 () => { |
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
| 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 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) { |