Skip to content

Instantly share code, notes, and snippets.

View samoshkin's full-sized avatar

Alexey Samoshkin samoshkin

View GitHub Profile
@samoshkin
samoshkin / index.sql
Last active August 31, 2023 12:15
Query index properties in PosgreSQL: "hash" index
/*
===================
INDEX PROPERTIES
===================
*/
/*
NOTE: In this example, we explore "hash" index properties using PostgreSQL system catalog tables
*/
@samoshkin
samoshkin / index.md
Created April 5, 2023 20:02
Statements about Python

Statements describing Python as a language

Interpreted: Python is an interpreted language, which means that the source code is translated and executed line-by-line at runtime, rather than being compiled to machine code beforehand.

Dynamic type system: Python uses a dynamic type system, which means that variable types are determined at runtime and can change during the execution of a program.

Garbage-collected: Python automatically manages memory allocation and deallocation using garbage collection, which frees developers from having to manually manage memory in their code.

Indentation-based syntax: Python uses indentation to define code blocks, making the code more readable and less cluttered with braces or other delimiters.

@samoshkin
samoshkin / socket-io-and-redux-saga-integration.js
Last active September 12, 2023 06:32
Socket.IO and redux-saga integration. Connection management
import { io } from 'socket.io-client';
import * as SentrySDK from '@sentry/react';
import {
call,
fork,
takeEvery,
put,
race,
take,
} from 'redux-saga/effects';
@samoshkin
samoshkin / app.js
Created November 14, 2022 21:34
Node application entry point and runner based on "redux-saga" library
const Sentry = require('@sentry/node');
const {
fork,
} = require('redux-saga/effects');
async function init() {
// create any services and run all startup activites (e.g start HTTP server, connect to Db, etc)
const dbConn = await mongoDb.connect(config.services.mongo);
Basic.db = dbConn;
@samoshkin
samoshkin / index.js
Created November 4, 2021 08:58
Process items from Iterable in parallel with given concurrency factor
async function eachParallel(iterable, action, concurrencyFactor) {
const evt = new EventEmitter();
let runningCount = 0;
let cancelled = false;
const errors = new Map();
let ended = false;
const emit = evt.emit.bind(evt);
const on = evt.on.bind(evt);
const until = eventName => new Promise(res => evt.once(eventName, res));
@samoshkin
samoshkin / jira_ticket_status_diagram_in_mermaid.mmd
Created August 28, 2021 06:30
JIRA ticket state diagram written in Mermaid DSL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@samoshkin
samoshkin / conditionally_build_array_using_if_else_blocks.js
Created August 20, 2021 19:05
Conditionally build an array using if..else blocks
const deployment = {
debug: process.env.NODE_ENV === 'development',
};
const defaultIntegrations = integrations.filter(x => x.name !== 'Dedupe');
const integrations = [
// add all the default integrations but those which were excluded using spread syntax
...defaultIntegrations,
@samoshkin
samoshkin / conditionally_build_array_using_logical_and_operator_1.js
Created August 20, 2021 18:44
Conditionally build array using logical AND operator
const deployment = {
debug: process.env.NODE_ENV === 'development',
};
const defaultIntegrations = integrations.filter(x => x.name !== 'Dedupe');
return [
// add all the default integrations but those which were excluded using spread syntax
...defaultIntegrations,
@samoshkin
samoshkin / conditional_rendering_in_react.jsx
Created August 20, 2021 18:17
Conditional rendering in React and JSX
import React, { useCallback } from "react";
import { createEventPageUrl } from "app/packages/error-handling";
function ErrorBoundaryFallback(props) {
const { error, componentStack, resetError, eventId } = props;
const renderEventId = useCallback(eventId => (
<a href="createEventPageUrl(eventId))">{eventId}</a>
), []);
@samoshkin
samoshkin / tech_lead_role.md
Last active October 31, 2023 10:09
Tech Lead role and responsibilities

What I mean by "Tech Lead" role and responsibilities

  1. It's the person who is responsible for the technical quality of the project. For example, the Team agrees to adhere to a particular level of quality (e.g no linter errors, no failing tests, naming conventions, Git branching model, release cycles, modular structure, software design practices and principles). The Tech Lead is the person who detects violations of our quality policy, communicates it to team members, and explains what should be improved.

  2. Tech Lead has a high-level vision of the project architecture, and also aware of low-level details and nuances, by being involved in everyday development activities.

  3. Tech lead spends 80% of his time in development activities. Otherwise, he will lose the technical feeling of the project, and become a "Сферический конь в вакууме". In the same way, Tech Lead is not limited only to tech debt or infrastructure-related tasks, he works on regular product