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
# STEP 1 | |
# | |
# Install tailwind. We need the force flag because the angular builder | |
# has a peer dependency on tailwind ^2.0.0 || ^3.0.0 | |
# Issue to address this: https://github.com/angular/angular-cli/issues/27585 | |
# | |
$ npm i -D tailwindcss@next @tailwindcss/postcss@next --force | |
# STEP 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
<script> | |
/** | |
* You can use CountUp directly like this: | |
*/ | |
import { onMount } from 'svelte'; | |
import { CountUp } from 'countup.js'; | |
let targetEl, countUpAnim | |
onMount(() => { |
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 { useEffect, useRef } from 'react' | |
// playground: https://stackblitz.com/edit/react-ts-nv5fxe?file=App.tsx | |
export default function App() { | |
// create a ref and declare an instance for each countUp animation | |
const countupRef = useRef(null); | |
let countUpAnim; | |
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 { | |
AbstractControl, | |
AsyncValidatorFn, | |
ValidationErrors, | |
ValidatorFn, | |
Validators, | |
} from '@angular/forms'; | |
export class CustomValidators { | |
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
export function roughSizeOfObject(object) { | |
const objectList = []; | |
const stack = [object]; | |
let bytes = 0; | |
while (stack.length) { | |
const value = stack.pop(); | |
if (typeof value === 'boolean') { | |
bytes += 4; | |
} else if (typeof value === 'string') { | |
bytes += value.length * 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 { Injectable } from '@angular/core'; | |
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import { AuthContextManagerService } from './some/where/authContextService.ts'; | |
@Injectable() | |
export class AuthorizationInterceptor implements HttpInterceptor { | |
constructor(private authContextService: AuthContextManagerService) {} | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { |
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 { Directive, Inject, Input, Output, EventEmitter, OnInit, ElementRef } from '@angular/core'; | |
import { WINDOW } from '../../services/window.service'; | |
import { Router, NavigationEnd } from '@angular/router'; | |
import { fromEvent, Subject, Observable } from 'rxjs'; | |
import { map, distinctUntilChanged, filter, takeUntil, debounceTime } from 'rxjs/operators'; | |
/* | |
* Emits boolean event when element passes | |
* threshold of either fromBottom or fromTop, | |
* or emits when element is in view |
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
getUsersLocale(defaultValue: string): string { | |
if (typeof window === 'undefined' || typeof window.navigator === 'undefined') { | |
return defaultValue; | |
} | |
const wn = window.navigator as any; | |
let lang = wn.languages ? wn.languages[0] : defaultValue; | |
lang = lang || wn.language || wn.browserLanguage || wn.userLanguage; | |
return lang; | |
} |
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 * as expressWs from 'express-ws'; | |
import * as WebSocket from 'ws'; | |
/** | |
* Extend this class to make a new WebSocket endpoint. | |
* | |
* Derived classes should pass an Express app object and the | |
* string endpoint, and must implement handleMessage() | |
*/ | |
export abstract class WebSocketMock { |
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
{"lastUpload":"2020-07-17T20:23:56.317Z","extensionVersion":"v3.4.3"} |
NewerOlder