Skip to content

Instantly share code, notes, and snippets.

View dkhrunov's full-sized avatar
📭
Searching for a job

Denis Khrunov dkhrunov

📭
Searching for a job
  • Russia, Penza
View GitHub Profile
@kashifulhaque
kashifulhaque / NvChad.md
Last active November 2, 2025 23:09
Neovim NvChad keybinds

Neovim keybinds

  • Capital letters do the opposite of small letters in command (Press shift to trigger capital letters)
  • _ (underscore) to move the cursor at the beginning of line (doesn't switch to insert mode)
    • 0 (zero) moves the cursor to the zeroth position of the line (doesn't switch to insert mode)
  • $ (dollar) to move the cursor at the end of line (doesn't switch to insert mode)
  • d$ will delete from wherever your cursor is till the end of the line
  • f<character> to move cursor to the first occurrence of <character>
    • f( to move cursor to first occurence of (
  • t<character> to move cursor to upto but not on the first occurrence of <character>
  • t( to move cursor to first occurence of (
@dkhrunov
dkhrunov / query-params-tracker-builder.interface.ts
Last active July 14, 2022 13:29
Angular QueryParamsTracker - allows to react on changes in the source Observable and sets this value to URL queryParams and also in the opposite direction
import { ActivatedRoute, Router } from '@angular/router';
import { QueryParamsTracker } from './query-params-tracker';
import {
QueryParamsMapper,
SourceValueMapper,
} from './query-params-tracker.types';
export interface IQueryParamsTrackerBuilder<
TValue,
TParams = TValue,
@dkhrunov
dkhrunov / cache-options.interface.ts
Last active July 14, 2022 13:30
Angular HttpClient request caching decorator / any other Observables caching decorator
export interface ICacheOptions {
/**
* Кастомное хранилище кэша, если не передать,
* то будет использоваться стандартное хранилище `CacheService` из `RootModule`.
*
* @default CacheService - хранилище из `RootModule`.
*/
storage?: ICacheStorage;
/**
* `Observable` инвалидации кэша.
@dkhrunov
dkhrunov / spy.directive.ts
Created July 10, 2021 18:53
A spy directive like this can provide insight into a DOM object that you cannot change directly. You can't touch the implementation of a native <div>, or modify a third party component. You can, however watch these elements with a directive.
// Spy on any element to which it is applied.
// Usage: <div appSpy>...</div>
@Directive({ selector: '[appSpy]' })
export class SpyDirective implements OnInit, OnDestroy {
constructor(private logger: LoggerService) { }
ngOnInit() {
this.logger.log(`Spy: onInit`);
}
@dkhrunov
dkhrunov / on-destroy.service.ts
Last active July 14, 2022 13:34
Сервис реализующий "живой" поток пока компонент не будет удален, после удаления завершает поток.
import { Injectable, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
/**
* Сервис реализующий "живой" поток пока компонент не будет удален,
* после удаления завершает поток.
*
* @see {@link https://medium.com/ngx/why-do-you-need-unsubscribe-ee0c62b5d21f|
* Ссылка на статью, параграф - 'Использование сервиса NgOnDestroy'}
*
@zmts
zmts / fingerprint.md
Last active February 1, 2025 11:44
Get browser fingerprint example (fingerprintjs2)

Get browser fingerprint example (fingerprintjs2)

import * as Fingerprint2 from 'fingerprintjs2'
import * as UAParser from 'ua-parser-js'

function _getFingerprint () {
  return new Promise((resolve, reject) => {
    async function getHash () {
      const options = {
@qoomon
qoomon / conventional-commits-cheatsheet.md
Last active November 3, 2025 20:10
Conventional Commits Cheatsheet
@zmts
zmts / tokens.md
Last active October 29, 2025 08:59
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@paulirish
paulirish / what-forces-layout.md
Last active November 3, 2025 14:02
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent