Skip to content
View JonCatmull's full-sized avatar
Block or Report

Block or report JonCatmull

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse

Pinned

  1. Angular2 + TypeScript file size Pipe... Angular2 + TypeScript file size Pipe/Filter. Convert bytes into largest possible unit. e.g. 1024 => 1 KB
    1
    /**
    2
     * @license
    3
     * Copyright (c) 2019 Jonathan Catmull.
    4
     *
    5
     * Permission is hereby granted, free of charge, to any person obtaining a copy
  2. Relative date Pipe for Angular2 + Ty... Relative date Pipe for Angular2 + TypeScript . Convert date|timestamp into relative date string e.g. "5 days ago", "1 minute ago" etc.
    1
    import { Pipe, PipeTransform } from '@angular/core';
    2
    
                  
    3
    // Epochs
    4
    const epochs: any = [
    5
        ['year', 31536000],
  3. Appends ordinal (st, nd ,rd ,th) to ... Appends ordinal (st, nd ,rd ,th) to number or turns number into ordinal. Typescript Angular2 Pipe
    1
    import { Pipe, PipeTransform } from '@angular/core';
    2
    
                  
    3
    const ordinals: string[] = ['th','st','nd','rd'];
    4
    
                  
    5
    /*
  4. RXJS operator function to store a st... RXJS operator function to store a stream in localStorage, then replays from localStorage when provided BehaviourSubject is true. This is helpful if you need to replay a complicated set of observable streams after a browser redirect.
    1
    
                  
    2
      /**
    3
       * Stores last emitted value in localStorage and replays if usStore$ is set.
    4
       * If usStore$ is truthy then switches stream to use stored value.
    5
       * If usStore$ is undefined then stream will emit as normal.
  5. RxJs operator to reload a JWT when i... RxJs operator to reload a JWT when it expires
    1
    import { MonoTypeOperatorFunction, BehaviorSubject, Observable } from 'rxjs';
    2
    import { switchMapTo, tap, shareReplay } from 'rxjs/operators';
    3
    import JwtDecode from 'jwt-decode';
    4
    
                  
    5
    /**
  6. RxJS custom operator to debounce a s... RxJS custom operator to debounce a stream for set time after first value is emitted.
    1
    
                  
    2
      /**
    3
       * Debounce after first emit.
    4
       * This operator will debounce all requests apart from the first for a set duration.
    5
       * @param ms time to wait in milliconds.