Install gcloud https://cloud.google.com/sdk/docs/install
Login and set project
gcloud init
Install gcloud https://cloud.google.com/sdk/docs/install
Login and set project
gcloud init
/** | |
* Gets the document type from a Firestore DocumentReference | |
*/ | |
export type DocumentReferenceType<T> = T extends DocumentReference<infer U> ? U : never; |
/** | |
* A `CompositionFunction` creates or updates one specific property on | |
* your mock data object. It returns a new `Builder` instance with that | |
* updated property value. | |
* | |
* @example | |
* // Suppose we have a builder for a User object | |
* // The `.username('SteveRogers')` is a composition function call: | |
* const steve = UserBuilder.username('SteveRogers').build(); | |
*/ |
/** | |
* Splits array when splitOn function returns true. Matched item will kept and be first in the subsequent child array. | |
* @param items | |
* @param splitOn | |
*/ | |
export const splitArray = <T>( | |
items: T[], | |
splitOn: (item: T) => boolean, | |
keepSplitItem = true | |
): T[][] => { |
/** | |
* Takes menu structure limits the number of levels of nesting. | |
* @param menuItems | |
* @param maxLevels | |
* @param level | |
*/ | |
export const truncateNesting = <T extends { children?: T[] }>( | |
menuItems: T[], | |
maxLevels: number, | |
level = 1 |
import { MonoTypeOperatorFunction, BehaviorSubject, Observable } from 'rxjs'; | |
import { switchMapTo, tap, shareReplay } from 'rxjs/operators'; | |
import JwtDecode from 'jwt-decode'; | |
/** | |
* Replays a JWT observable stream. If the JWT's exp passes then the source observable | |
* will be re triggered automatically to get a new token. | |
* This replays last value so the token will only update when it expires or because of an | |
* upstream event, regardless of new subscriptions. Look up shareReplay() for more details. | |
* @requires exp Token's must contain a exp to be used with this. |
/** | |
* Stores last emitted value in localStorage and replays if usStore$ is set. | |
* If usStore$ is truthy then switches stream to use stored value. | |
* If usStore$ is undefined then stream will emit as normal. | |
* @param storageKey unique key to use in localStorage | |
* @param useStore$ controls if the localStorage value is used | |
*/ | |
export default function localStorageReplay<T>(storageKey: string, useStore$: BehaviorSubject<boolean>): MonoTypeOperatorFunction<T> { | |
return (input$): Observable<T> => { |
/** | |
* Debounce after first emit. | |
* This operator will debounce all requests apart from the first for a set duration. | |
* @param ms time to wait in milliconds. | |
*/ | |
const debounceAfterFirst = <T,>(ms: number) => (source: Observable<T>) => { | |
return source.pipe( | |
map((val: T, index: number) => ({ val, index } as { index: number; val: T })), | |
debounce(({ index }) => timer(index === 0 ? 0 : ms)), |
curl -o lightsail-compose.sh https://raw.githubusercontent.com/JonCatmull/docker/master/lightsail-compose.sh | |
chmod +x ./lightsail-compose.sh | |
./lightsail-compose.sh |
/*! | |
* Froala Line Height plugin | |
* froala_editor v2.7.1 (https://www.froala.com/wysiwyg-editor) | |
*/ | |
!function (a) { | |
"function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof module && module.exports ? module.exports = function (b, c) { | |
return void 0 === c && (c = "undefined" != typeof window ? require("jquery") : require("jquery")(b)), a(c), c | |
} : a(jQuery) | |
}(function (a) { |