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
| // custom hook to prefetch components | |
| const usePrefetch = (factory) => { | |
| const [component, setComponent] = useState(null) | |
| useEffect(() => { | |
| factory() | |
| const comp = lazy(factory) | |
| setComponent(comp) | |
| }, [factory]) |
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 makePromise = num => { | |
| return new Promise((resolve, reject) => { | |
| const delay = Math.floor(Math.random() * 3000); | |
| console.log(num, delay); | |
| setTimeout(() => { | |
| if (delay > 2000) { | |
| reject(num); | |
| } else { | |
| resolve(num); |
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 MyComponent from './MyComponent'; | |
| import { dataFetch, dataFetched } from '../actions'; | |
| const mapStateToProps = ({ data }) => ({ | |
| data | |
| }); | |
| const fetchDataFromUrl = (dispatch) => async (url) => { | |
| dispatch(dataFetch()); |
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 styled, { css } from 'styled-components' | |
| export const Container = styled.div` | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| padding: 0 8px; | |
| ` | |
| export const Row = styled.div` | |
| 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
| const fs = require('fs'); | |
| const postcss = require('postcss'); | |
| const autoprefixer = require('autoprefixer'); | |
| const postcssCustomProperties = require('postcss-custom-properties'); | |
| const postcssCalc = require('postcss-calc'); | |
| const csso = require('csso'); | |
| const source = fs.readFileSync('./source/main.css'); | |
| const processResult = postcss() |
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
| 'use strict' | |
| const webpack = require('webpack') | |
| const path = require('path') | |
| module.exports = { | |
| entry: { | |
| app: ['react-hot-loader/patch', path.resolve(__dirname, './src/index.js')] | |
| }, |
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
| class ToggleButton { | |
| static get adapter() { | |
| return { | |
| addClass: (element, className) => {}, | |
| removeClass: (element, className) => {}, | |
| hasClass: (element, className) => {}, | |
| setTextContent: (element, text) => {}, | |
| addEventHandler: (element, event, handler) => {}, | |
| removeEventHandler: (element, event, handler) => {} | |
| }; |
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
| { | |
| "editor.fontFamily": "Fira Code", | |
| "editor.fontSize": 14, | |
| "editor.fontLigatures": true, | |
| "editor.formatOnSave": true, | |
| "editor.tabSize": 2, | |
| "editor.letterSpacing": 0.5, | |
| "editor.renderWhitespace": "all", | |
| "editor.renderIndentGuides": true, | |
| "editor.wordWrap": "on", |
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
| git branch – показать список локальных веток | |
| git branch -r – показать список удаленных веток | |
| git branch -a – показать список всех веток (локальных и удаленных) | |
| git checkout <branch> / <commit> – переключиться на ветку / коммит | |
| git checkout -b <branch> – создать новую ветку | |
| git branch -D <branch> – удалить существующую ветку | |
| git push origin :<branch> – удалить удаленную ветку на сервере | |
| git fetch – взять изменения с сервера | |
| git pull – взять изменения с сервера и смержить их с текущей локальной веткой | |
| git pull origin – взять изменения с сервера и смержить их о всеми локальными ветками |
NewerOlder