Skip to content

Instantly share code, notes, and snippets.

View snigo's full-sized avatar
🖥️
Coding...

Igor Snitkin snigo

🖥️
Coding...
  • Gigwork
  • Barcelona
View GitHub Profile
@snigo
snigo / git-flow.md
Last active April 29, 2021 14:20
Git flow cheat sheet

Git flow


Step 1. Create git repo

git init
@snigo
snigo / recursion-guide.md
Last active November 20, 2020 11:57
Guide to understanding recursion

Part 1. Precedence

First step to understand recursion requires understanding of operator precedence in JavaScript:

Operator precedence determines how operators are parsed concerning each other. Operators with higher precedence become the operands of operators with lower precedence. Source

To put it simply, if you have this code:

Docker cheatsheet


Dockerfile

FROM node:latest
COPY package*.json ./
RUN npm install
/**
* In order to use property decorator we need to import
* built-in Reflect.metadata decorator
*/
import 'reflect-metadata';
/**
* 1. CLASS DECORATOR
*/
@snigo
snigo / redux-cheat-sheet.md
Last active August 17, 2022 13:35
Redux Cheat Sheet

Plugging redux in

The most straightforward way to plug in Redux:

  1. Create initial state of your app
// initial-state.js
const initialState = {
  user: null,
  todos: {
    active: [],
const button = document.getElementById('btn');
function handleClick(clickEvent) {
/** React on click event */
}
button.addEventListener('click', handleClick);
const API_URL = 'https://mysuperduperapp.com/api';
function parseResponse(response) {
/** React on response event */
return response.json();
}
function handleResponse(data) {
/** React on successful parsing (job done) event */
}
function handleRequest(req, res) {
/** React on GET request */
}
router.get('/api/topic/:id', handleRequest);
/** Accessing files */
fs.readFile('./index.html', handleDoneReading);
/** Dealing with streams */
httpClient.get(API_URL)
.subsribe(handleObservableData);
/** Accessing database */
User.findOne({ name: 'Igor' }, handleFoundData);