Skip to content

Instantly share code, notes, and snippets.

Avatar

Henning Dieterichs hediet

View GitHub Profile
@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)();
}
/**
View demo.ts
// shared
export const debuggerProxyContract = contract({
server: {
keepAlive: notificationContract({}),
},
client: {
serverStarted: notificationContract({ params: type({ port: number }) }),
clientConnected: notificationContract({}),
},
});
View Schema.ts
type SchemaType = PrimitiveSchema | ObjectSchema | ParametrizedObjectSchema;
interface PrimitiveSchema<T = any> {
kind: "primitive";
type: T;
}
interface Fields {
[name: string]: SchemaType;
}
View Latex Alternative.txt
function tex(str: TemplateStringsArray, ...data: string[]) { }
const c = Sigma* *1
const Sigma = "uiae";
const SigmaS = "";
const x =
(
<def>
Ein {Sigma}-{Sigma}-Advice (Hinweis) {A} ist eine Abbildung
{A : Sigma* -> Pot(Gamma*)}
@hediet
hediet / installation.json
Created Jul 9, 2017
Alternative to node_modules
View installation.json
{
"dependencies": {
"classnames": {
"ref": "classnames@2.2.5_1"
},
"mobx": {
"ref": "mobx@3.2.0_2"
},
"mobx-react": {
"ref": "mobx-react@4.2.2_3"
@hediet
hediet / main.ts
Created Apr 21, 2017
Acceptor / User Pattern for TypeScript
View main.ts
interface Acceptor<T extends string> {
accept(x: UserOf<T>): any;
allow<T1 extends string>(x: T1): Acceptor<T|T1>;
}
interface UserOf<T extends string> {
_brand: T;
}
function use<T extends string>(name: T): UserOf<T> { return null!; }
@hediet
hediet / main.md
Last active Oct 27, 2020
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;
You can’t perform that action at this time.