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', | |
}, |
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
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
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
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 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
import { Decoder, array, decode, lazy, object, oneOf, string } from "./typescript-json-decoder"; | |
type TreeEntry = string | { name: string; contents: TreeRoot }; | |
type TreeRoot = TreeEntry[]; | |
function getTreeEntryDecoder(): Decoder<TreeEntry> { | |
return oneOf<TreeEntry>( | |
string, | |
object({ contents: lazy(getTreeDecoder), name: string }) | |
); |
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
// @flow | |
import React, { Component, type Node } from 'react'; | |
import PropTypes from 'prop-types'; | |
type RenderFn<T> = (value: T) => Node; | |
export type ProviderProps<T> = { | |
value: T, | |
children?: Node | |
}; |
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
FROM python:2.7 | |
ADD . /app | |
WORKDIR /app | |
RUN pip install -r requirements.txt | |
RUN cp server/settings/local.py.skel server/settings/local.py | |
RUN sed -i "s/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = ['localhost']/g" server/settings/local.py | |
RUN SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1); sed -i "s/SECRET_KEY = ''/SECRET_KEY = '$SECRET_KEY'/g" server/settings/local.py | |
RUN mkdir logs |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
clicked: 0, | |
actions: { | |
clicked() { | |
this.set('clicked', this.get('clicked') + 1); | |
} | |
} |
NewerOlder