Skip to content

Instantly share code, notes, and snippets.

View Hydrock's full-sized avatar

Alex Vechkanov Hydrock

View GitHub Profile
@zcaceres
zcaceres / Include-in-Sequelize.md
Last active April 2, 2025 06:07
using Include in sequelize

'Include' in Sequelize: The One Confusing Query That You Should Memorize

When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).

When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.

Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.

So let's go through the one query that's worth memorizing to handle your eager loading.

The Basic Query

@faressoft
faressoft / dom_performance_reflow_repaint.md
Last active September 11, 2025 12:12
DOM Performance (Reflow & Repaint) (Summary)

DOM Performance

Rendering

  • How the browser renders the document
    • Receives the data (bytes) from the server.
    • Parses and converts into tokens (<, TagName, Attribute, AttributeValue, >).
    • Turns tokens into nodes.
    • Turns nodes into the DOM tree.
  • Builds CSSOM tree from the css rules.
@matthiassb
matthiassb / dns-sync.sh
Last active August 24, 2024 09:43
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO

Более удобной и актуальной версией является эта статья с использованием traefik

https://gist.github.com/dancheskus/365e9bc49a73908302af19882a86ce52


Certbot и nginx, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>encodeURI vs encodeURIComponent</title>
<style>
html {
font-size: 20px;
@YozhEzhi
YozhEzhi / cats.md
Last active December 13, 2024 16:15
[Конспект] Дж.Ханк Рейнвотер - Как пасти котов. Наставление для программистов, руководящих другими программистами
@theodorosploumis
theodorosploumis / Nework_throttling_profiles.md
Last active September 5, 2025 19:01
Web development - Custom network throttling profiles
Profile download (kb/s) upload (kb/s) latency (ms)
Native 0 0 0
GPRS 50 20 500
56K Dial-up 50 30 120
Mobile EDGE 240 200 840
2G Regular 250 50 300
2G Good 450 150 150
3G Slow 780 330 200
@nodkz
nodkz / readme.md
Created November 15, 2020 11:14
Что такое Стейт Менеджер для вас?

Что такое Стейт Менеджер для вас?

Чтоб вы поняли мою точку зрения, мне придется зайти с далека, чтобы вас ввести в свой контекст. Буду говорить просто и квадратно, и можно зацепиться за любое предложение и опровергнуть его.

Так вот начнем с далека. Человек изобрел транзистор. Из них собрали регистры, логичейские гейты AND, OR, XOR и пошла поехала булевая логика. Еще чутка напряглись и собрали калькуляторы и компьютеры. Поняли, что считает эта штука быстрее человека, и надо туда засовывать всё больше и больше вычислительной логики.

В 50-ых минули времена инструкций и чистого ассемблера, придумали языки программирования высокого уровня, типа Fortran, который позволял людям быстрее писать программы. Завезли туда переменные (VARIABLES) и начали писать безумные алгоритмы вычисления.

Так активно писали, что где-то в 60х запарились и придумали функции (FUNCTIONS), чтоб изолировать/инкапсулировать куски логики и алгоритмов. Привет функциональному подходу из 60х.

@bastaramus
bastaramus / vpn_fix_wsl_routes.ps1
Created January 19, 2021 14:48
Powershell script to fix internet connection issue with WSL2 and CheckPoint VPN
[IPAddress]$IP_wsl = (Get-NetIPAddress -InterfaceAlias "vEthernet (WSL)" -AddressFamily "IPv4" | Select-Object IPAddress).ipaddress
$PrefixLength_wsl = (Get-NetIPAddress -InterfaceAlias "vEthernet (WSL)" -AddressFamily "IPv4" | Select-Object PrefixLength).prefixlength
$idx_vpn = (Get-NetAdapter | Where-Object {$_.InterfaceDescription -Match "Check Point"} | Select-Object ifIndex).ifIndex
Function CIDRToNetMask {
[CmdletBinding()]
Param(
[ValidateRange(0,32)]
[int16]$PrefixLength=0
)