Skip to content

Instantly share code, notes, and snippets.

Henning Dieterichs hediet

Block or report user

Report or block hediet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hediet
hediet / main.md
Last active Nov 1, 2019
Proof that TypeScript's Type System is Turing Complete
View main.md
type StringBool = "true"|"false";


interface AnyNumber { prev?: any, isZero: StringBool };
interface PositiveNumber { prev: any, isZero: "false" };

type IsZero<TNumber extends AnyNumber> = TNumber["isZero"];
type Next<TNumber extends AnyNumber> = { prev: TNumber, isZero: "false" };
type Prev<TNumber extends PositiveNumber> = TNumber["prev"];
@hediet
hediet / WebBrowserIE11Fix.cs
Created Aug 17, 2016
A fix that enables IE11 for the WPF browser control.
View WebBrowserIE11Fix.cs
internal static class WebBrowserIE11Fix
{
public static void SetIE11KeyforWebBrowserControl(string processPath = null)
{
if (processPath == null)
{
processPath = Process.GetCurrentProcess().ProcessName + ".exe";
}
RegistryKey Regkey = null;
View PatternMatching.ts
import { hotClass, registerUpdateReconciler } from "@hediet/node-reload";
import { ts, Node, SyntaxKind, TypeGuards, Identifier } from "ts-morph";
registerUpdateReconciler(module);
import { registerAll } from "C:\\Users\\Henning\\Desktop\\playground\\vscode-debug-visualizer\\data-extraction";
registerAll();
@hotClass(module)
export class PatternMatchMain {
@hediet
hediet / createProgram.ts
Created Sep 11, 2019
createProgram from tsConfigSearchPath
View createProgram.ts
import * as ts from "typescript";
import { dirname, resolve } from "path";
export function createProgram(tsConfigSearchPath: string): ts.Program {
const configPath = ts.findConfigFile(
tsConfigSearchPath,
ts.sys.fileExists,
"tsconfig.json"
);
View I18n.ts
interface FormatDescriptor {
id: string;
defaultTemplate?: string;
}
export type Formatted =
| { kind: 'text'; value: string }
| { kind: 'sequence'; items: Formatted[] }
| { kind: 'object'; items: Record<string, Formatted> };
@hediet
hediet / types.ts
Created Jul 23, 2019
DestructureTuple & DeepSelect
View types.ts
export type DestructureTuple<T extends any[]> = T extends []
? false
: ((...tuple: T) => void) extends ((
first: infer TFirst,
...rest: infer TRest
) => void)
? { first: TFirst; rest: TRest }
: false;
View types.ts
import * as remarkAbstract from "remark";
interface Position {}
interface Node<T extends string = string> {
position: Position;
type: T;
}
interface NodeList<T extends string = string, TItem extends Node = Node>
@hediet
hediet / helper.ts
Last active Jun 3, 2019
React Dependency Injection
View helper.ts
import * as React from "react";
import { Container } from "inversify";
export function ref<T>(name: string): { T: T; id: string } {
return {
T: null!,
id: name
};
}
@hediet
hediet / A
Last active Apr 28, 2019
Solution for A and B so that AB = (Q ∪ { ϵ }) for all words up to length 9 and a ϵ A and ab ϵ B
View A
a
aaaaababb
ababa
abababa
b
babab
babababab
@hediet
hediet / Config.ts
Last active Apr 25, 2019
Config System
View Config.ts
// tslint:disable: no-shadowed-variable
/**
* Describes a new configuration.
*/
export function newConfig(): Config {
return new (Config as any)();
}
/**
You can’t perform that action at this time.