Skip to content

Instantly share code, notes, and snippets.

View uladzislau-stuk's full-sized avatar
🤙
Have a good code day!

u.s uladzislau-stuk

🤙
Have a good code day!
View GitHub Profile
@uladzislau-stuk
uladzislau-stuk / Readme.md
Last active October 14, 2019 15:17
Windows CLI

Windows Cmd

$ netstat -aon | find "123456" - Find PID (ProcessID) for port 123456
$ taskkill /f /im 15696 - Kill the zombie process

Bash

$ netstat -aon | grep "123456" - Find PID (ProcessID) for port 123456
@uladzislau-stuk
uladzislau-stuk / README.md
Last active May 15, 2020 09:57
[Interview questions Web-developer, Front-end Engineer, Common Questions For JS Users]
@uladzislau-stuk
uladzislau-stuk / snippet.js
Created July 30, 2019 15:25
[@material-ui/styles]
import React from 'react';
import { styled } from '@material-ui/styles';
import Button from '@material-ui/core/Button';
const MyButton = styled(({ color, ...other }) => <Button {...other} />)({
background: props =>
props.color === 'red'
? 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)'
: 'linear-gradient(45deg, #2196F3 30%, #21CBF3 90%)',
border: 0,
@uladzislau-stuk
uladzislau-stuk / Readme.md
Last active October 22, 2019 14:16
[Async-await use cases] #js-async

Await in loops

const arr = ['url1', 'url2', 'url3']

 (async () => {
	console.log('Start')
@uladzislau-stuk
uladzislau-stuk / snippet.js
Last active July 23, 2019 12:37
[Traverses a DOM (sub)tree] #js
/* and executes a given function on each Element and Text node it visits. */
function walkTheDOM(node, func) {
func(node);
node = node.firstChild;
while (node) {
walkTheDOM(node, func);
node = node.nextSibling;
}
}
@uladzislau-stuk
uladzislau-stuk / README.md
Last active December 24, 2019 06:21
[Redux] #redux

About

  • state management library
  • can be used as a data store for any UI layer

When?

  • you have reasonable amounts of data changing over time, you need a single source of truth

Why?

  • attempts to make state mutations predictable by imposing certain restrictions on how and when updates can happen
@uladzislau-stuk
uladzislau-stuk / README.md
Last active December 18, 2019 09:07
[React Native] #reactnative

Basics

import { Text, View } from 'react-native';

Styles, Layout with Flexbox

Note:Flexbox works the same way in React Native as it does in CSS on the web, with a few exceptions. The defaults are different, with flexDirection defaulting to column instead of row, and the flex parameter only supporting a single number.

View is container for other components, to help control styles and layout

@uladzislau-stuk
uladzislau-stuk / README.md
Last active December 24, 2019 17:52
[React project structure, best practice]

Best practices

  • pascalCase for component file name and folder name
  • lowerCamelCase for Higher Order Component file and folder name
  • lowercase for all other root directory folders. For example: src, components, assets

Anti-pattern

  • anti-pattern to copy properties that never change to the state (just access .props directly in that case)

Note: Using props to generate state in getInitialState often leads to duplication of “source of truth”, i.e. where the real data is.