Skip to content

Instantly share code, notes, and snippets.

View obenjiro's full-sized avatar
🎯
Focusing

Alexey Okhrimenko obenjiro

🎯
Focusing
View GitHub Profile
@gh0st026
gh0st026 / docker_export_postgre_table.sh
Last active February 13, 2023 02:15
Dump PostgreSQL Table in docker container as CSV file
CONTAINER="name"
DB="Db name"
TABLE="Table Name"
FILE="file.csv"
sudo docker exec -u postgres ${CONTAINER} psql -d ${DB} -c "COPY ${TABLE} TO STDOUT WITH CSV HEADER " > ${FILE}
import PropTypes from 'prop-types';
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
type Defined<T> = T extends undefined ? never : T;
/**
* Get the type that represents the props with the defaultProps included.
*
* Alternatively, we could have done something like this:
@JoniJnm
JoniJnm / date-fns-date-adapter.ts
Created January 4, 2019 11:44
date-fns angular material adapter
import {Injectable} from '@angular/core';
import {DateAdapter} from '@angular/material';
import {addDays, addMonths, addYears, format, getDate, getDaysInMonth, getMonth, getYear, parse, setDay, setMonth, toDate} from 'date-fns';
// CONFIG. Use environment or something for a dynamic locale and settings
import {es as locale} from 'date-fns/locale';
const WEEK_STARTS_ON = 1; // 0 sunday, 1 monday...
export const MAT_DATE_FNS_DATE_FORMATS = {
@Busyrev
Busyrev / gzip.md
Last active June 15, 2025 18:20
О сжатии на протокольном уровне (http)

О сжатии на протокольном уровне (http)

Актулизировано на момент 03.12.2018 Док несколько потерял в актуальности, см презентацию https://docs.google.com/presentation/d/1bw0ypsrdyC2l35Z-h65D09ABQDSZ_Ecfp02-zE6Fmqc Если кратко то brotli 0 в 4 раза быстрее чем gzip 1, при том же сжатии И brotli 4 столь же быстр как gzip 1 на круче чем gzip 9

Обозреваемые форматы сжатия:

  • gzip 1 - минимальный уровень сжатия gzip, результат .gz
  • gzip 9 - максимальный уровень сжатия gzip, результат .gz
  • zopfli - отдельный алгоритм совместимый с распаковщиком gzip, результат .gz
@LayZeeDK
LayZeeDK / angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Last active July 13, 2025 02:40
Angular CLI, Angular, Node.js, TypeScript, and RxJS version compatibility matrix. Officially part of the Angular documentation as of 2023-04-19 https://angular.io/guide/versions
Angular CLI version Angular version Node.js version TypeScript version RxJS version
~16.0.0 ~16.0.0 ^16.13.0 || ^18.10.0 >=4.9.5 <5.1.0 ^6.5.5 || ^7.4.0
~15.2.0 ~15.2.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.1.0 ~15.1.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.0.5 ~15.0.4 ^14.20.0 || ^16.13.0 || ^18.10.0 ~4.8.4 ^6.5.5 || ^7.4.0
~14.3.0 ~14.3.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.2.0 ~14.2.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.1.3 ~14.1.3 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~14.0.7 ~14.0.7 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~13.3.0 ~13.3.0 ^12.20.2 || ^14.15.0 || ^16.10.0 >=4.4.4 <4.7.0 ^6.5.5 || ^7.4.0

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
const hasDevTools = (function () {
const ping = new Image();
let devToolsOpened;
Object.defineProperty(ping, 'id', {
get() { devToolsOpened = true; }
});
return function hasDevTools () {
devToolsOpened = false;
@JiaLiPassion
JiaLiPassion / zone-blacklist.js
Created September 17, 2017 04:24
New Zone BlackList
// before load polyfill.js
<script>
// black list scroll event handler for addEventListener
Zone[Zone.__symbol__('BLACK_LISTED_EVENTS')] = ['scroll', 'mouseenter', 'mouseleave', 'mousemove', 'mouseover', 'mouseout', 'mousewheel'];
// black list scroll event handler for onProp
const targets = [window, Document.prototype, HTMLBodyElement.prototype, HTMLElement.prototype];
__Zone_ignore_on_properties = [];
targets.forEach(function(target) {
__Zone_ignore_on_properties.push({
@giuseppebonaccorso
giuseppebonaccorso / svd_recommender_tensorflow.py
Last active February 12, 2023 11:07
SVD Recommendations using Tensorflow
import numpy as np
import tensorflow as tf
# Set random seed for reproducibility
np.random.seed(1000)
nb_users = 5000
nb_products = 2000
nb_factors = 500
max_rating = 5
@samthor
samthor / safari-nomodule.js
Last active July 14, 2025 04:50
Safari 10.1 `nomodule` support
// UPDATE: In 2023, you should probably stop using this! The narrow version of Safari that
// does not support `nomodule` is probably not being used anywhere. The code below is left
// for posterity.
/**
* Safari 10.1 supports modules, but does not support the `nomodule` attribute - it will
* load <script nomodule> anyway. This snippet solve this problem, but only for script
* tags that load external code, e.g.: <script nomodule src="nomodule.js"></script>
*
* Again: this will **not** prevent inline script, e.g.: