Skip to content

Instantly share code, notes, and snippets.

View AntonGorelov's full-sized avatar
:octocat:

Anton G AntonGorelov

:octocat:
  • WIS Software
  • Rostov-on-Don, Russia
View GitHub Profile
import { Directive, ElementRef, Input, NgZone } from '@angular/core';
import { HotToastService } from '@ngneat/hot-toast';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { fromEvent, switchMap } from 'rxjs';
@UntilDestroy()
@Directive({
selector: '[copy]'
})
export class CopyDirective {
private _initSelectedPeople(): void {
// this._targetStateService.getAllPeople()
// .pipe(takeUntil(this._destroyed$))
// .subscribe((allPeople: TargetModel[]) => {
//
// console.log(allPeople, 'allpeople');
//
// let ids = [];
// this._activatedRoute.queryParamMap
// .pipe(take(1))
private _initSelectedPeople(): void {
// this._targetStateService.getAllPeople()
// .pipe(takeUntil(this._destroyed$))
// .subscribe((allPeople: TargetModel[]) => {
//
// console.log(allPeople, 'allpeople');
//
// let ids = [];
// this._activatedRoute.queryParamMap
// .pipe(take(1))
@AntonGorelov
AntonGorelov / date-mask.directive.ts
Last active January 9, 2023 13:55
Using text-mask with Material datepicker
import { Directive, ElementRef, OnDestroy } from '@angular/core';
import * as textMask from 'vanilla-text-mask/dist/vanillaTextMask.js';
@Directive({
selector: '[appMaskDate]'
})
export class MaskDateDirective implements OnDestroy {
public mask = [/\d/, /\d/, '/', /\d/, /\d/, '/', /\d/, /\d/, /\d/, /\d/]; // dd/mm/yyyy
public maskedInputController;
describe('VideoService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpModule],
providers: [
{ provide: VIMEO_API_URL, useValue: 'http://example.com' },
VideoService,
{ provide: XHRBackend, useClass: MockBackend },
describe('TaskApiService', () => {
let httpClient: HttpClient;
let taskApiService: TaskApiService;
let httpTestingController: HttpTestingController;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [TaskApiService],
});
@AntonGorelov
AntonGorelov / js-questions.md
Last active April 1, 2020 11:51
JS questions
  1. Что покажут эти два alert()?
var foo = 'Hello';
(function() {
  var bar = ' World';
  alert(foo + bar);
})();
alert(foo + bar);
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
import { FormGroup } from '@angular/forms';
import { Observable } from 'rxjs';
import { environment } from '@env';
import { ICompany, ID, ITeamMember, IUser } from '@lib/models';
import { RansackHttpUrlEncodingCodec } from './shared/ransack-http-url-encoding.codec';
@Injectable()