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
| { | |
| "[css]": { | |
| "editor.defaultFormatter": "esbenp.prettier-vscode" | |
| }, | |
| "[xml]": { | |
| "editor.defaultFormatter": "esbenp.prettier-vscode" | |
| }, | |
| "[html]": { | |
| "editor.defaultFormatter": "esbenp.prettier-vscode" | |
| }, |
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
| ### Node ### | |
| # Logs | |
| logs | |
| npm-debug.log* | |
| yarn-debug.log* | |
| yarn-error.log* | |
| # Optional npm cache directory | |
| .npm |
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 randomString = (len) => { | |
| const chars = 'abcdefhijkmnprstwxyz123456789ABCDEFGHJKMNPQRSTWXYZ'; | |
| const totalLength = chars.length; | |
| let randomStr = ''; | |
| for (let i = 0; i < len; i += 1) { | |
| randomStr += chars.charAt(Math.floor(Math.random() * totalLength)); | |
| } | |
| return randomStr; | |
| }; |
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 getUnique(array) { | |
| const u = {}; | |
| const a = []; | |
| for (let i = 0, l = array.length; i < l; ++i) { | |
| if (u.hasOwnProperty(array[i])) { | |
| continue; | |
| } | |
| a.push(array[i]); | |
| u[array[i]] = 1; | |
| } |
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 isUnique(array) { | |
| const u = {}; | |
| let isUnique = 1; | |
| for (let i = 0, l = array.length; i < l; ++i) { | |
| if (u.hasOwnProperty(array[i])) { | |
| isUnique = 0; | |
| break; | |
| } | |
| u[array[i]] = 1; | |
| } |
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
| { | |
| "trailingComma": "es5", | |
| "printWidth": 200, | |
| "tabWidth": 2, | |
| "singleQuote": true, | |
| "jsxSingleQuote": true, | |
| "bracketSpacing": true, | |
| "htmlWhitespaceSensitivity": "css", | |
| "jsxBracketSameLine": 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
| const path = require('path'); | |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| const CopyPlugin = require('copy-webpack-plugin'); | |
| const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | |
| const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
| const isProd = process.env.NODE_ENV === 'production'; | |
| const isDev = !isProd; | |
| const filename = ext => isProd ? `bundle.[fullhash].${ext}` : `bundle.${ext}`; |
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 webpack = require('webpack'); | |
| const path = require('path'); | |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| const CopyPlugin = require('copy-webpack-plugin'); | |
| const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | |
| const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
| const isProd = process.env.NODE_ENV === 'production'; | |
| const isDev = !isProd; |
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
| // Файл "tsconfig.json": | |
| // - устанавливает корневой каталог проекта TypeScript; | |
| // - выполняет настройку параметров компиляции; | |
| // - устанавливает файлы проекта. | |
| // Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта. | |
| // Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта. | |
| // Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга. | |
| // Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути. | |
| // Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию. | |
| // Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json". |
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 * as Rx from "rxjs"; | |
| const observable = Rx.Observable.fromEvent(document, 'click'); | |
| // subscription 1 | |
| observable.subscribe((event) => { | |
| console.log(event.clientX); // x position of click | |
| }); | |
| // subscription 2 |
NewerOlder