Skip to content

Instantly share code, notes, and snippets.

View slavafomin's full-sized avatar
✌️
Let's make this World a better place!

Slava slavafomin

✌️
Let's make this World a better place!
View GitHub Profile
@Component()
export class SomeComponent implements AfterViewInit {
@ViewChild(RouterOutlet)
outlet: RouterOutlet;
ngAfterViewInit (): void {
if (this.outlet.isActivated) {
this.doSomethingWithComponent(this.outlet.component);
main.bundle.js:1494 Uncaught TypeError: Object.setPrototypeOf called on null or undefined
at setPrototypeOf (<anonymous>)
at webpackJsonp.../../../../../src/ui-components/src/components/checkbox/checkbox.component.ts.__extends (main.bundle.js:1494)
at checkbox.component.ts:18
at Object.../../../../../src/ui-components/src/components/checkbox/checkbox.component.ts (checkbox.component.ts:19)
at __webpack_require__ (bootstrap e9bc34c43daefa8fa1f1:54)
at Object.../../../../../src/ui-components/src/ui-components.module.ts (ui-components-samples.module.ts:80)
at __webpack_require__ (bootstrap e9bc34c43daefa8fa1f1:54)
at Object.../../../../../src/app/html-outlet.directive.ts (home.component.ts:8)
at __webpack_require__ (bootstrap e9bc34c43daefa8fa1f1:54)
@slavafomin
slavafomin / npm5-vs-yarn.md
Last active May 17, 2018 08:50
npm 5 vs yarn

npm 5 vs yarn

Looks like npm decided to stand up to yarn by releasing npm version 5, which is announced to be 5 times faster than previous version of npm.

I've decided to test it in one of my projects, the results are below:

Performance Benchmark

@slavafomin
slavafomin / 0-README.md
Last active March 15, 2023 13:35
Angular 2 match other field validator / Password match validator

Angular 2 match other field validator

This custom validator for Angular 4 allows you to have fields that must be equal to some other fields. Such validator is very useful for password confirmation validation, for example.

Besides checking if two values are matching, it also subscribes to changes from other control and re-validates when either of two controls is updated.

Usage

@slavafomin
slavafomin / git-submodules.md
Last active February 19, 2025 03:15
Git submodules best practices

Git submodules best practices

Useful commands

— Clone repository with submodules automatically:

git clone --recursive [email protected]:name/repo.git

— Initialize submodules after regular cloning:

@slavafomin
slavafomin / add-user.sh
Last active February 18, 2021 14:59
Generate .htpasswd file for nginx basic authentication
#!/usr/bin/env bash
read -p "Username: " USERNAME
read -s -p "Password: " PASSWORD; echo
printf "${USERNAME}:$(openssl passwd -crypt ${PASSWORD})\n" >> ./.htpasswd
@slavafomin
slavafomin / docker-cheat-sheet.md
Created April 17, 2017 21:19
Docker Cheat Sheet

Docker Cheat Sheet

Open shell inside of the running container

docker exec -t -i container-name /bin/bash

Use /bin/sh if your Docker image doesn't has bash (e.g. Alpine).

@slavafomin
slavafomin / tilda-scripts-patch.md
Last active December 7, 2016 21:02
Tilda Cover's Min Width For Video Patch

tilda-scripts-2.6.js

1). Add the following snippet to the cover_init function (before $isMobile is first used):

var minWidthForVideo = parseInt(el.attr('data-min-width-for-video')) || null;
var imageMode = $isMobile;
var windowWidth = $(window).width();
if (minWidthForVideo &amp;&amp; windowWidth &lt; minWidthForVideo) {
@slavafomin
slavafomin / confirm-one-click-action.twig
Created October 2, 2016 04:31
This partial in Twig defines "Confirm" one-click action for E-Mail messages.
{#
Defined "Confirm" one-click action.
@param {string} title
@param {string} url
@param {string} [description]
#}
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ConfirmAction">
<meta itemprop="name" content="{{ title }}"/>
const gulpPostcss = require('gulp-postcss');
const postcssPartialImport = require('postcss-partial-import');
const postcssCssnext = require('postcss-cssnext');
const gulpRename = require('gulp-rename');
const gulpLivereload = require('gulp-livereload');
const gulpCssnano = require('gulp-cssnano');
const gulpif = require('gulp-if');
const sourcemaps = require('gulp-sourcemaps'); // <========================================