Skip to content

Instantly share code, notes, and snippets.

View 197291's full-sized avatar
:octocat:

Yuriy Provotorov 197291

:octocat:
  • Taganrog
View GitHub Profile
@197291
197291 / .editorconfig
Created May 29, 2019 09:58
Editorconfig
root = true
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
@197291
197291 / tslint
Created May 29, 2019 09:57
Tslint configuration file
{
"extends": ["tslint-react"],
"rules": {
"align": [
true,
"parameters",
"statements"
],
"ban": false,
"class-name": true,
@197291
197291 / .prettierrc
Created May 29, 2019 09:56
Prettier configuration file
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"jsxSingleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
@197291
197291 / tsconfig.ts
Created May 29, 2019 09:55
Typescript configuration file
{
"compilerOptions": {
"outDir": "build/dist",
"module": "esnext",
"baseUrl": "./src",
"resolveJsonModule": true,
"noEmit": true,
"target": "es5",
"lib": [
"es6",
var lengthOfLongestSubstring = function(s) {
let start = 0, maxLen = 0;
const map = new Map();
for(let i = 0; i < s.length; i++) {
const ch = s[i];
if(map.get(ch) >= start) start = map.get(ch) + 1;
map.set(ch, i);
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} l1
* @param {ListNode} l2
@197291
197291 / InputMultiImage
Created February 7, 2019 07:39
Load Multiple Images
import React, { ChangeEvent } from 'react';
import cx from 'classnames';
import uuid from 'uuid';
import photoIcon from 'Common/assets/photo.svg';
import './index.css';
export interface IProps {
setImgUrl(img: {
id: string;
let brackets = {
"[": "]",
"{": "}",
"(": ")",
"<": ">"
}
function correctBrackets (str) {
const vals = Object.keys(brackets).map(key => brackets[key]);
const keys = Object.keys(brackets);
function Node(value) {
this.data = value;
this.previous = null;
this.next = null;
}
function DoublyList() {
this._length = 0;
this.head = null;
this.tail = null;
}
@197291
197291 / CheckChangesReact.ts
Created January 9, 2019 08:57
CheckChanges ComponentDidUpdate, ComponentWillReceiveProps
export const checkChangesDidUpdate = (prevProps: any, prevState: any, curProps: any, curState: any) => {
(Object as any).entries(curProps).forEach(([key, val]) =>
prevProps[key] !== val && console.log(`Prop '${key}' from ${prevProps[key]} to ${curProps[key]} changed`)
);
(Object as any).entries(curState).forEach(([key, val]) =>
prevState[key] !== val && console.log(`State '${key}' from ${prevState} to ${curState} changed`)
);
};