Skip to content

Instantly share code, notes, and snippets.

View SergeyLitvin's full-sized avatar

Serhii Lytvyn SergeyLitvin

  • Epic Games
  • Kharkiv region, Zmiiv
View GitHub Profile
@SergeyLitvin
SergeyLitvin / main.js
Last active April 13, 2018 20:31
OOP - Functional style
// Функция конструктор (способ создания в функциональном стиле ООП) - не приветствуется
function Animal(legs) {
this.legs = legs;
this.walks = function(){
return 'Proudly walks on all ' + this.legs + ' legs';
}
// Создание экземпляра класса
let animal = new Animal(4);
console.log(animal); //{ legs: 4, walks: [Function] }
@SergeyLitvin
SergeyLitvin / css_comments
Last active February 17, 2019 20:29
CSS comments style and teamplate
/* ==========================================================================
Style block comment
========================================================================== */
@SergeyLitvin
SergeyLitvin / html_comments
Last active May 17, 2021 13:00
HTML block comment teamplate
<!-- ==================================================
HTML block comment
================================================== -->
@SergeyLitvin
SergeyLitvin / js_comment
Created February 17, 2019 20:34
JS comment block style
/* ==================================================
JS comment block style
================================================== */
/* Reset */
body,div,dl,dt,dd,ul,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,input,textarea,p,blockquote,th,td{
margin: 0;
padding: 0;
}
table{
border-collapse: collapse;
border-spacing: 0;
}
@SergeyLitvin
SergeyLitvin / Update npm
Last active February 28, 2019 21:25
Update npm to last version
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade -p -v latest
<!-- https://ru.vuejs.org/v2/guide/single-file-components.html -->
<!-- my-component.vue -->
<template src="./my-component.html"></template>
<script src="./my-component.js"></script>
<style src="./my-component.css"></style>
Используется как справочный комментарий перед функцией – о том, что именно она делает, какие параметры принимает и что возвращает.
/**
* Возвращает x в степени n, только для натуральных n
*
* @param {number} x Число для возведения в степень.
* @param {number} n Показатель степени, натуральное число.
* @return {number} x в степени n.
*/
@SergeyLitvin
SergeyLitvin / eslint-config-react-app
Created June 12, 2019 14:33
Instruction configuring eslint-config-react-app
npm install --save-dev eslint-config-react-app babel-eslint@10.0.1 eslint@5.16.0 eslint-plugin-flowtype@3.10.1 eslint-plugin-import@2.17.3 eslint-plugin-jsx-a11y@6.2.1 eslint-plugin-react@7.13.0 eslint-plugin-react-hooks@1.6.0
Usage Outside of Create React App
If you want to use this ESLint configuration in a project not built with Create React App, you can install it with the following steps.
First, install this package, ESLint and the necessary plugins.
npm install --save-dev eslint-config-react-app babel-eslint@10.0.1 eslint@5.16.0 eslint-plugin-flowtype@3.10.1 eslint-plugin-import@2.17.3 eslint-plugin-jsx-a11y@6.2.1 eslint-plugin-react@7.13.0 eslint-plugin-react-hooks@1.6.0
Then create a file named .eslintrc.json with following contents in the root folder of your project:
git branch --set-upstream <remote-branch>
устанавливает удаленную ветвь по умолчанию для текущей локальной ветки.
Любая будущая команда git pull (с выводом текущей локальной ветки),
попытается выполнить фиксацию с <remote-branch> в текущую локальную ветвь.
Чтобы избежать путаницы, последние версии git обесценивают этот несколько неоднозначный параметр --set-upstream в пользу более подробного варианта --set-upstream-to с идентичным синтаксисом и поведением
git branch --set-upstream-to <remote-branch>