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 moment from 'moment'; | |
export const EMAIL_REGEXP = /[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])/; | |
const isInRange = (date: moment, [from, to]: [moment, moment]): boolean => | |
date.isSameOrAfter(from, 'day') && date.isSameOrBefore(to, 'day'); | |
type ValidatorReturn = string | null; | |
type Validator<T> = (value: T) => ValidatorReturn; | |
type Predicate<T> = (value: T) => boolean; |
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
pg_dump --format=custom --no-acl --no-owner -U USER1 -h HOST1 DATABASE1 > database.dump | |
pg_restore --verbose --clean --no-acl --no-owner -U USER2 -h HOST2 -d DATABASE2 database.dump |
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 { createContext } from 'react'; | |
interface SystemStatus { | |
isOnline: boolean; | |
} | |
const SystemStatusContext = createContext<SystemStatus>({ | |
get isOnline(): never { | |
throw new Error('Used outside of SystemStatusContext'); | |
} |
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
const foo = { a: 1, b : {}} | |
const bar: { a: number} = foo; | |
const baz: { [a: string]: number} = bar; | |
const b = baz['b']; | |
if (typeof b !== 'undefined') { | |
console.log(b.toFixed(2)) | |
} |
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
const path = require('path'); | |
module.exports = { | |
parserOptions: { | |
tsconfigRootDir: __dirname, // required for VS Code | |
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true, // required for TS project references | |
}, | |
extends: ['./frontend-app'], // or backend | |
settings: { | |
'import/resolver': { |
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 { ESLintUtils, TSESTree } from '@typescript-eslint/utils'; | |
import * as tsutils from 'tsutils'; | |
import * as ts from 'typescript'; | |
export const rule = ESLintUtils.RuleCreator.withoutDocs({ | |
meta: { | |
docs: { | |
description: 'ban date comparison using ==, ===, !=, !==', | |
recommended: 'warn', | |
}, |
OlderNewer