Skip to content

Instantly share code, notes, and snippets.

import {
CommandLineChoiceParameter,
CommandLineFlagParameter,
CommandLineStringParameter,
} from "@rushstack/ts-command-line";
import { DeployManager } from "../../logic/deploy/DeployManager";
import { RushCommandLineParser } from "../RushCommandLineParser";
import { BaseRushAction } from "./BaseRushAction";
type MapDirContentsOptions = {
dirPath: string;
pattern: string;
};
const mapDirContents = ({
dirPath,
pattern,
}: MapDirContentsOptions): Map<string, string> => {
const fileNames = glob.sync(path.join(dirPath, pattern), {
dot: true,
@dfee
dfee / fizzbuzz.ts
Created February 20, 2020 23:22
Typing the technical interview with TypeScript (code sample)
type And<A, B> = A extends true ? B extends true ? true : false : false;
type Eq<A, _B extends A> = "passes";
type test_eq = [
Eq<"Hello", "Hello">,
Eq<"World", "World">,
]
type NAN = "invalid number";
type Increment<N> = [N, "+1"];
import { useState, useEffect } from "react";
export type AsyncState<T> =
| { loading: false; error?: undefined; value?: undefined }
| { loading: true; error?: undefined; value?: undefined }
| { loading: false; error: Error; value?: undefined }
| { loading: false; error?: undefined; value: T };
export type AsyncUtils<C extends {}, A extends any[]> = {
setArgs: (args: A | undefined) => void;
@dfee
dfee / bidirectional-react-type.tsx
Last active January 18, 2019 23:01
map React.ReactType -> ElementType -> React.ReactType
/**
* type MyType = "table" // a keyof JSX.IntrinsicElements
* type MyTypeElementType = ElementTypeFromReactType<MyType>; // => HTMLTableElement
* type MyType2 = ReactTypeFromElementType<MyTypeElementType>; // => "table"
**/
import * as React from 'react';
/**
* Map a React.ReactType "T" to it's real type:
@dfee
dfee / Button.mdx
Last active January 11, 2019 00:56
SimplePropsTable for `docz`
name
Button

Properties

<SimplePropsTable props={{ color: { required: false,

import asyncio
import enum
import inspect
import typing
import graphql
import pytest
class MutationEnum(enum.Enum):
const marked = require("marked");
module.exports = (nextConfig = {}) => {
return Object.assign({}, nextConfig, {
webpack(config, options) {
config.module.rules.push({
test: /\.(html)$/,
use: {
loader: "html-loader",
options: {
[tool.poetry]
name = "demo"
version = "0.1.0"
description = ""
authors = ["Devin Fee"]
[tool.poetry.dependencies]
python = "*"
[tool.poetry.dev-dependencies]
[tool.poetry]
name = "barry.rpc"
version = "2018.0.0"
description = "mypkg rpc module"
authors = ["Devin Fee <dev...>"]
packages = [
{ include = "mypkg" },
]
[tool.poetry.dependencies]