This file contains 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
/** | |
* Append script to HTML page | |
* | |
* | |
* @param src {string} | |
*/ | |
createScript(src: string): void { | |
const configsScript = document.createElement('script'); | |
configsScript.type = 'text/javascript'; | |
configsScript.innerText = ` |
This file contains 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 { environment } from '@amaleyat/environments/dev.environment'; | |
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; | |
import { Inject, Injectable, PLATFORM_ID } from '@angular/core'; | |
import { Observable } from 'rxjs/internal/Observable'; | |
import { throwError } from 'rxjs/internal/observable/throwError'; | |
import { catchError } from 'rxjs/internal/operators/catchError'; | |
import { isPlatformBrowser } from '@angular/common'; | |
@Injectable({ | |
providedIn: 'root' |
This file contains 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 { Component, OnInit } from '@angular/core'; | |
import { GoogleTagManagerService } from './google-tag-manager.service'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html' | |
}) | |
export class AppComponent implements OnInit { | |
constructor(private gtmService: GoogleTagManagerService) {} |
This file contains 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 { environment } from '@amaleyat/environments/dev.environment'; | |
import { HttpClient, HttpErrorResponse } from '@angular/common/http'; | |
import { Inject, Injectable, PLATFORM_ID } from '@angular/core'; | |
import { Observable } from 'rxjs/internal/Observable'; | |
import { throwError } from 'rxjs/internal/observable/throwError'; | |
import { catchError } from 'rxjs/internal/operators/catchError'; | |
import { isPlatformBrowser } from '@angular/common'; | |
import { LanguageService } from './language.service'; | |
@Injectable({ |
This file contains 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 { User } from '@amaleyat/shared/models/user'; | |
import { isPlatformBrowser } from '@angular/common'; | |
import { HttpInterceptorFn } from '@angular/common/http'; | |
import { inject, PLATFORM_ID } from '@angular/core'; | |
export const authInterceptor: HttpInterceptorFn = (req, next) => { | |
const platformId: Object = inject(PLATFORM_ID); | |
if (isPlatformBrowser(platformId)) { |
This file contains 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
const CACHE_IT = new HttpContextToken<boolean>(() => false); | |
export function cacheIt() { | |
return new HttpContext().set(CACHE_IT, true); | |
} | |
@Injectable() | |
export class CacheInterceptor implements HttpInterceptor { | |
intercept(request: HttpRequest, next: HttpHandler): Observable<HttpEvent> { |
This file contains 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 { Injectable } from "@angular/core"; | |
export enum LogLevel { | |
DEBUG, | |
INFO, | |
ERROR, | |
} | |
@Injectable() | |
export class LogService { | |
minimumLevel: LogLevel = LogLevel.INFO; | |
This file contains 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
private itersection(textOne: string, textTwo: string): string { | |
let textOneIndex: number = 0; | |
let textTwoIndex: number = 0; | |
let matchedText: string = ''; | |
textOne = textOne.toLowerCase(); | |
textTwo = textTwo.toLowerCase(); | |
while (textOneIndex < textOne.length && textTwoIndex < textTwo.length) { | |
if (textOne[textOneIndex] < textTwo[textTwoIndex]) { |
This file contains 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
const { writeFileSync } = require('fs') | |
const { join } = require('path') | |
const BUILD_DATE_TIME_STAMP_PATH = join(__dirname, 'build-date.json'); | |
const createBuildDate = { | |
buildDate: new Date() | |
} | |
writeFileSync(TIME_STAMP_PATH, JSON.stringify(createBuildDate, null, 2)); |
This file contains 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 { Component, HostListener, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { |
NewerOlder