This file contains hidden or 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
static requestShow() { | |
return async (dispatch, getState) => { | |
const showId = getState().show.currentShowId; | |
dispatch(ActionUtility.createAction(ShowAction.REQUEST_SHOW)); | |
const model = await ShowEffect.requestShow(showId); | |
const isError = model instanceof HttpErrorResponseModel; | |
dispatch(ActionUtility.createAction(ShowAction.REQUEST_SHOW), model, isError); |
This file contains hidden or 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 const createArrayChunk = <T>(arr: T[], size: number): T[][] => { | |
const chunkSize: number = Math.ceil(arr.length / size); | |
return Array.from({ length: chunkSize }, (_, i: number) => { | |
const startIndex: number = i * size; | |
const endIndex: number = startIndex + size; | |
return arr.slice(startIndex, endIndex); | |
}); | |
}; |
This file contains hidden or 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
class SomeClass { | |
public static singleton: SomeClass; | |
constructor(){ | |
if(SomeClass.singleton){ | |
return SomeClass.singleton; | |
} | |
SomeClass.singleton = this; |
This file contains hidden or 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
function isObject(o) { | |
return Object.prototype.toString.call(o) === '[object Object]'; | |
} | |
function deepClone(data) { | |
if (Array.isArray(data)) { | |
return data.map(deepClone); | |
} else if (isObject(data)) { | |
return Object.keys(data).reduce(function(o, k) { | |
o[k] = deepClone(data[k]); |
This file contains hidden or 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
function isObject(o) { | |
return Object.prototype.toString.call(o) === '[object Object]'; | |
} | |
function deepClone(data) { | |
if (Array.isArray(data)) { | |
return data.map(deepClone); | |
} else if (isObject(data)) { | |
return Object.keys(data).reduce(function(o, k) { | |
o[k] = deepClone(data[k]); |
This file contains hidden or 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 static _getWidthAndLeftPercentage(beginningDateTime: string, endingDateTime: string): WidthLeftMethodUnion { | |
const beginningDateTimeInSeconds: number = moment(endingDateTime).diff(beginningDateTime, 'seconds'); | |
return (startDateTime: string, endDateTime: string): IWidthLeft => { | |
const startSeconds: number = moment(startDateTime).diff(beginningDateTime, 'seconds'); | |
const endSeconds: number = moment(endDateTime).diff(beginningDateTime, 'seconds'); | |
const leftPercentage: number = (startSeconds / beginningDateTimeInSeconds) * 100; | |
const widthPercentage: number = ((endSeconds - startSeconds) / beginningDateTimeInSeconds) * 100; | |
console.log(`leftPercentage`, leftPercentage); |
This file contains hidden or 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 {ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot} from '@angular/router'; | |
import {Observable, of} from 'rxjs'; | |
import {catchError, filter, first, switchMap, tap} from 'rxjs/operators'; | |
import {select, Store} from '@ngrx/store'; | |
import {IStore} from '../../../stores/i-store'; | |
import {AuthAction} from '../stores/auth/auth.action'; | |
@Injectable() | |
export class AuthGuard implements CanActivate { |
This file contains hidden or 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 default class TimeUtility { | |
public static SECONDS_IN = { | |
WEEK: 604800, | |
DAY: 86400, | |
HOUR: 3600, | |
MINUTE: 60, | |
}; | |
public static getCountdownFromSeconds(seconds: number): string { | |
if (seconds < 60) { |
This file contains hidden or 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
type SizeUnion = | |
| 'title1' | |
| 'title2' | |
| 'title3' | |
| 'headline' | |
| 'subhead' | |
| 'caption1' | |
| 'caption2' | |
| 'body1' | |
| 'callout' |
This file contains hidden or 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 default class Util { | |
/** | |
* Recursive function that makes a clone of an object. | |
* | |
* @param src {Object} The object you to clone. | |
* @param renamePropertyNameFunction {(keyName: string) => string} Optional function to rename property names | |
* @returns {any} Returns a clone object of the one passed in. | |
* @example | |
* let cloneOfObject = Util.clone(obj); | |
*/ |