This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpResponse } from '@angular/common/http'; | |
import { Injectable } from '@angular/core'; | |
import { Observable, of, timer } from 'rxjs'; | |
import { mergeMap, tap, retryWhen, delayWhen } from 'rxjs/operators'; | |
@Injectable() | |
/** | |
* This class is used to intercept network errors with status 500+ and some 400s | |
* then add failed request to the queue and try to resend it after | |
* some times. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Directive, | |
ElementRef, | |
EmbeddedViewRef, | |
EventEmitter, | |
HostListener, | |
Injectable, | |
Input, | |
OnDestroy, | |
OnInit, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
FILES_LIST=$(git diff --name-only ${CURRENT_BRANCH} $(git merge-base ${CURRENT_BRANCH} master) | awk '/\.ts$/ {print "--lint-file-patterns="$0}') | |
npm run lint -- <project_name> $FILES_LIST |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'dateformat', | |
}) | |
export class DateFormatPipe implements PipeTransform { | |
transform(value: string): string { | |
const valDate = new Date(value); | |
if (this.isToday(valDate)) { | |
return `Сегодня`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable, MonoTypeOperatorFunction, of } from "rxjs"; | |
import { retryWhen, delay, take, catchError, concatMap } from "rxjs/operators"; | |
let globalCounter = 0; | |
const emitter$ = new Observable((subscriber) => { | |
if (globalCounter >= 5) { | |
subscriber.next("Heey, finally i'am work!"); | |
subscriber.complete(); | |
} |