Skip to content

Instantly share code, notes, and snippets.

@klinkov
Last active August 23, 2021 17:18
Show Gist options
  • Save klinkov/d4516f8b470ecc239ca6b4951dfb00f2 to your computer and use it in GitHub Desktop.
Save klinkov/d4516f8b470ecc239ca6b4951dfb00f2 to your computer and use it in GitHub Desktop.
GPB useful links
Date-fns
https://date-fns.org
https://github.com/you-dont-need/You-Dont-Need-Momentjs
Webpack
https://habr.com/ru/company/skbkontur/blog/351080/ // !!!!
https://www.excitoninteractive.com/articles/series/1002/webpack4
https://habr.com/ru/company/jugru/blog/342842/
https://medium.com/fafnur/сборка-typescript-приложения-с-помощью-webpack-8cd04eba6a8f
https://github.com/webpack-contrib/webpack-bundle-analyzer
Webpack5
https://habr.com/ru/post/488464/
Tests
https://tproger.ru/translations/webpack-from-zero-to-hero/
https://testing-library.com/docs/react-testing-library/api
https://habr.com/ru/post/340514/
https://medium.com/devschacht/berry-de-witte-unit-testing-your-react-application-with-jest-and-enzyme-6ef3658fdc93 // Модульные тесты
React catch render error with dispatcher
https://github.com/x-orpheus/catch-react-error
React Route
https://medium.com/@robjtede/the-real-routewithprops-react-component-in-typescript-defacde01991
React Reducers (!!!)
https://blog.usejournal.com/writing-better-reducers-with-react-and-typescript-3-4-30697b926ada
React Code Split / App Organize
https://medium.com/javascript-in-plain-english/code-splitting-with-react-31d76d3f64ab
https://levelup.gitconnected.com/enterprise-size-react-application-directory-structure-90b0ebc60d59
TS Enums
https://blog.logrocket.com/writing-readable-code-with-typescript-enums-a84864f340e9/
// Initialize An Array
const generateSortedNumberArray = (length) => [...Array(length).keys()]
// res is [ 0, 1, 2, 3, 4 ]
const res = generateSortedNumberArray(5);
// Remove Duplicates From An Array
const removeDuplicates = (target) => [...new Set(target)];
// res is [ 1, 2, 3, 4 ]
const res = removeDuplicates([1, 2, 2, 3, 4, 1])
// Detect the Hover Effect Feature
const hasOverEffect = () => window.matchMedia('(any-hover: hover)').matches;
// res will be true for desktop devices and false for mobile ones
const res = hasOverEffect();
// Get/Set a Cookie Value
const getCookieValue = (name) => document.cookie.match(new RegExp(`${name}=(.*?);`))?.[1];
// res is the the value of the cookie feature_x
const res = getCookieValue('feature_x');
const setCookieValue = (name, value, path, domain) =>
document.cookie = `${name}=${value};${path ? 'path=' + path + '; ' : ''}${domain ? 'domain='+ domain + '; ' : ''}`
// updates the value of the cookie named feature_x
setCookieValue('feature_x', true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment