<project_root>/src/routes/types.ts
:
export interface IRoute {
name: string
page: string
pattern: string
}
import React from "react"; | |
const scaleWidth = 500; | |
const scaleHeight = 500; | |
function draw(canvas, scaleX, scaleY) { | |
const context = canvas.getContext("2d"); | |
context.scale(scaleX, scaleY); | |
context.clearRect(0, 0, canvas.clientWidth, canvas.clientHeight); |
import React from "react"; | |
function WidthAndHeight() { | |
const [width, setWidth] = React.useState(window.innerWidth); | |
const [height, setHeight] = React.useState(window.innerHeight); | |
React.useEffect(() => { | |
window.addEventListener("resize", updateWidthAndHeight); | |
return () => window.removeEventListener("resize", updateWidthAndHeight); | |
}); |
validationSchema: yup.object().shape({ | |
firstName: yup.string().required(validationMessages.firstName), | |
lastName: yup.string().required(validationMessages.lastName), | |
emailAddress: yup | |
.string() | |
.email(validationMessages.email) | |
.test('eitherOr', validationMessages.eitherEmail, function(emailAddress) { | |
// tslint:disable-next-line:no-invalid-this | |
return Boolean(emailAddress) || Boolean(this.parent.pin); | |
}), |
import { Component, OnInit } from '@angular/core'; | |
import {FormGroup, FormBuilder} from '@angular/forms'; | |
@Component({ | |
selector: 'my-app', | |
templateUrl: './app.component.html', | |
styleUrls: [ './app.component.scss' ] | |
}) | |
export class AppComponent implements OnInit { | |
checkoutForm: FormGroup; |
import React, {Component} from "react"; | |
import {connect} from "react-redux"; | |
import _ from "lodash"; | |
import { Message } from "semantic-ui-react"; | |
import {Portal} from 'react-portal'; | |
import {selectNotifications} from "./notificationSelectors"; | |
import {dismissNotification} from "./notificationActions"; |
interface IIsObject { | |
(item: any): boolean; | |
} | |
interface IObject { | |
[key: string]: any; | |
} | |
interface IDeepMerge { | |
(target: IObject, ...sources: Array<IObject>): IObject; |
/** | |
* https://github.com/acdlite/flux-standard-action | |
*/ | |
export interface IAction<T> { | |
type: string; | |
payload?: T; | |
error?: boolean; | |
meta?: any; | |
} |
/** | |
* generate hash+timestamp string | |
* validate hash+timestamp string from userland | |
*/ | |
const crypto = require('crypto'); | |
const SECRET = ' '; | |
function _generateHash(isoDateString) { | |
return crypto |