Skip to content

Instantly share code, notes, and snippets.

View antonpegov's full-sized avatar
🏠
Working from home

Anton Pegov antonpegov

🏠
Working from home
View GitHub Profile
@antonpegov
antonpegov / gist:90c3300b7c099982cde32ee02006e778
Created December 4, 2022 17:33
getaddrinfo ENOTFOUND <container name>
# open as Admin ...\etc\hosts and add container names to address resolution:
104.248.166.249 mongodb-primary mongodb-secondary mongodb-arbiter
@antonpegov
antonpegov / gist:3dfeb2d427da55474adee518f4c2df6c
Created December 4, 2022 16:54
Clean Restart of a Docker Instance
# Stop the container(s) using the following command:
docker-compose down
# Delete all containers using the following command:
docker rm -f $(docker ps -a -q)
# Delete all volumes using the following command:
docker volume rm $(docker volume ls -q)
# Restart the containers using the following command:
@antonpegov
antonpegov / gist:a9a897f1bdfce37ed84114d483111c13
Created November 27, 2022 11:11
WHen yarn is buggied with node wersion
sudo yarn install --ignore-engines
@antonpegov
antonpegov / find_build.sh
Created January 17, 2022 07:45
Find actual rust build
#!/bin/bash
for i in `seq 0 99`; do
echo " === === === "
RUST_DATE=`date -u -d "-$i days" "+%Y-%m-%d"`
echo "Checking $RUST_DATE..."
TOML=`curl -sf https://static.rust-lang.org/dist/$RUST_DATE/channel-rust-nightly.toml`
if [[ $? -gt 0 ]]; then
echo "Rust $RUST_DATE does not exist"
else
@antonpegov
antonpegov / gist:63399071c48f4537926005c47a243bbb
Last active June 17, 2021 12:14
Angular directive to control format of the Reactive Form numeric Input (Adds commas, allows one dot)
import { AfterViewInit, Directive, ElementRef, HostListener } from '@angular/core';
import { NgControl } from '@angular/forms';
@Directive({
selector: '[tnaDecimalMask]'
})
export class DecimalMaskDirective implements AfterViewInit{
constructor(private el: ElementRef, public model: NgControl) {}
@HostListener('input', ['$event'])
@antonpegov
antonpegov / gist:024afecfc0c79bd010c9f515e97e82c1
Last active June 9, 2021 13:04
launch.json to anable jest tests debugging in VSCode
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug CRA Tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/react-scripts",
"args": ["test", "--runInBand", "--no-cache", "--watchAll=false"],
"cwd": "${workspaceRoot}",
@antonpegov
antonpegov / gist:58d57058af94545990ab72606ff22a05
Created October 7, 2020 09:53
Listen for changes in Reactive Forms
...
myForm: FormGroup;
formattedMessage: string;
constructor(private formBuilder: FormBuilder) {}
ngOnInit() {
this.myForm = this.formBuilder.group({
name: '',
@antonpegov
antonpegov / gist:4b19059e81f4b25cf61df941a64589c8
Last active August 2, 2020 15:26
Cool css one-line tricks
### From https://www.youtube.com/watch?v=qm0IfG1GyZU&t=682s
#1 Pirfect centering: <place-items: center>
<div class="bg-primary parent">
<div class="bg-success box">
:)
</div>
</div>
@antonpegov
antonpegov / gist:cf52b5a06056ff6d8b9591e6f8d06f58
Created July 31, 2020 14:29
VSCode debug configuration for TS files
{
"name": "Launch TS Program",
"type": "node2",
"request": "launch",
"program": "${workspaceFolder}/Coins.ts",
"preLaunchTask": "tsc: build - tsconfig.json",
"cwd": "${workspaceRoot}",
"sourceMaps": true,
"env": {
"NODE_ENV": "development"
@antonpegov
antonpegov / gist:0b23f9324ef57c44eac86422fb9211f5
Created July 23, 2020 10:20
Sharing a Git Stash With Another Developer
# Creating the stash as a patch
$ git stash list
$ git stash show "stash@{0}" -p > changes.patch
# Applying the patch
$ git apply changes.patch
# Reversing the stash (if it is not needed anymore)