Skip to content

Instantly share code, notes, and snippets.

View hediet's full-sized avatar

Henning Dieterichs hediet

View GitHub Profile
@hediet
hediet / after.ts
Created April 3, 2020 12:37
Mobx Complex Observable Example
type State = { kind: 'loading' } | { kind: 'loaded'; service: unknown };
@injectable()
class LoadServiceModel {
constructor(
@injectProps()
private readonly props: {
service: ServiceId<unknown>;
module?: Module;
},
@hediet
hediet / feedback.md
Last active May 11, 2020 09:49
Binary Custom Editor API Feedback

Blocker

This issue is a blocker for the .drawio.png feature. This is my context. I hope something can be done there ;)

Confusion Points

  1. Default Generic Type Argument

I have to admit, I failed to recognize that CustomEditorProvider is generic when I exploratively implemented my first prototype.

@hediet
hediet / types.ts
Created June 9, 2020 14:48
JSON Schema TypeScript Types
export type JsonSchema =
| NumericJsonSchema
| StringJsonSchema
| ArrayJsonSchema
| ObjectJsonSchema
| JsonSchemaReference;
export interface JsonSchemaReference {
$ref: string;
}
@hediet
hediet / demo.md
Last active June 15, 2020 06:54
Avoid String Ids In Dependency Injection

Avoid String Ids In Dependency Injection

Option 1: String Ids

const myService = "MyService";

interface MyService {
    doSth(): void;
}
@hediet
hediet / main.ts
Created June 15, 2020 17:35
Dynamic Translation
/**
* Renders a translation that cannot be extracted statically.
* Avoid using this component as much as possible!
*/
export class TransMsgDynamic extends React.Component<{
keyAndDefaultTranslation: string;
/**
* A static id that represents the pool of all possible keys.
* If this id is not used in the code base anymore,
@hediet
hediet / rust.rs
Created March 9, 2021 18:16
Rust Sqlx Crazyness
use std::{marker::PhantomData, path::PathBuf};
use sqlx::{sqlite::SqliteConnectOptions, Error};
use sqlx::{Connection, Sqlite, Transaction};
use sqlx::{Executor, SqliteConnection};
pub struct DbFactory {
conn: SqliteConnection,
}