Skip to content

Instantly share code, notes, and snippets.

View blakazulu's full-sized avatar

Liraz Amir blakazulu

View GitHub Profile
@blakazulu
blakazulu / style.js
Last active February 7, 2021 08:54
Console Style
var style = "font-size: 24px;" +
"background: #67b26f; /* fallback for old browsers */" +
"background: -webkit-linear-gradient(to right, #67b26f, #4ca2cd); /* Chrome 10-25, Safari 5.1-6 */" +
"background: linear-gradient(to right, #67b26f, #4ca2cd); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */" +
"color: white;" +
"text-align: center;" +
"padding: 10px 15px;" +
"width: 100%;" +
"border-radius: 20px;";
@blakazulu
blakazulu / subscriber.guard.ts
Created January 25, 2021 14:23
Angular CMS
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree} from '@angular/router';
import {Observable} from 'rxjs';
import {AngularFirebaseService} from '../services/angular-firebase.service';
import {map, take, tap} from 'rxjs/operators';
import {User} from '../interfaces/user';
import {ConsoleLoggerService} from '../services/console-logger.service';
@Injectable({
providedIn: 'root'
@blakazulu
blakazulu / admin.guard.ts
Created January 25, 2021 14:17
Angular CMS
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree} from '@angular/router';
import {Observable} from 'rxjs';
import {AngularFirebaseService} from '../services/angular-firebase.service';
import {map, take, tap} from 'rxjs/operators';
import {User} from '../interfaces/user';
import {ConsoleLoggerService} from '../services/console-logger.service';
@Injectable({
providedIn: 'root'
@blakazulu
blakazulu / rxjs-helper.ts
Created January 25, 2021 14:10
Angular CMS
import {Subject} from 'rxjs';
export class RxjsHelper {
static destroySubject(subject$: Subject<any>): void {
if (subject$) {
subject$.next();
subject$.complete();
}
}
}
@blakazulu
blakazulu / date-helper.ts
Created January 25, 2021 14:09
Angular CMS
export class DateHelper {
static createDate(): number {
return Date.now();
}
static formatDate(timestamp: number): string {
return new Date(timestamp).toUTCString();
}
}
@blakazulu
blakazulu / date-format.pipe.ts
Created January 25, 2021 14:04
Angular CMS
import {Pipe, PipeTransform} from '@angular/core';
import {DateHelper} from '../utilities/date-helper';
@Pipe({
name: 'dateFormat'
})
export class DateFormatPipe implements PipeTransform {
transform(date: number): string {
return DateHelper.formatDate(date);
}
@blakazulu
blakazulu / safe.pipe.ts
Created January 25, 2021 14:01
Angular CMS
import {Pipe, PipeTransform} from '@angular/core';
import {DomSanitizer, SafeHtml, SafeResourceUrl, SafeScript, SafeStyle, SafeUrl} from '@angular/platform-browser';
export type SafePipeType
= 'html'
| 'style'
| 'script'
| 'url'
| 'resourceUrl';
@blakazulu
blakazulu / user.ts
Created January 25, 2021 13:39
Angular CMS
export interface User {
uid: string;
email: string;
displayName: string;
photoURL: string;
roles: Roles;
}
export interface Roles {
subscriber?: boolean;
@blakazulu
blakazulu / post.ts
Created January 25, 2021 13:39
Angular CMS
export interface Post {
id: string;
pageId: string;
title: string;
content?: string;
createdAt: number;
updatedAt: number;
}
@blakazulu
blakazulu / page.ts
Created January 25, 2021 13:39
Angular CMS
export interface Page {
id: string;
title: string;
url: string;
createdAt: number;
updatedAt: number;
}