Skip to content

Instantly share code, notes, and snippets.

View kristofdegrave's full-sized avatar

Kristof degrave kristofdegrave

View GitHub Profile
@kristofdegrave
kristofdegrave / LazyModuleMissingTranslationHandler
Created January 20, 2020 10:28
Loading additional translations when a lazy loaded module get's loaded
import { Observable } from 'rxjs';
import { tap, refCount, publishReplay, map } from 'rxjs/operators';
import {
MissingTranslationHandler,
MissingTranslationHandlerParams
} from '@ngx-translate/core';
export class LazyModuleMissingTranslationHandler extends MissingTranslationHandler {
translationsLoaded: { [language: string]: Observable<any> | boolean } = {};
@kristofdegrave
kristofdegrave / lazy-ng-module-with-providers.factory.ts
Last active March 24, 2023 16:12
NgModuleFactory that can handle ModuleWithProviders in a lazy loaded context (https://github.com/angular/angular/issues/34351)
class LazyNgModuleWithProvidersFactory<T> extends NgModuleFactory<T> {
constructor(private moduleWithProviders: ModuleWithProviders<T>) {
super();
}
get moduleType() {
return this.moduleWithProviders.ngModule;
}
create(parentInjector: Injector | null) {
@kristofdegrave
kristofdegrave / ApplicationArchitecture.md
Last active December 1, 2020 10:54
Application Architecture

Basics

What is an Application?

An application produces a binary. It contains the minimal amount of code required to package many libraries to create an artifact that is deployable. All of the application's code is organized into libraries, except for some startup logic and maybe some basic routing.

The application will also define how to build the artifacts that are shipped to the user. Depending on the targets (desktop, mobile or web), we will have separate apps, one app for one target.

What is a Library?

A library is a set of files packaged together that is consumed by applications. You can compare them withe node modules (npm packages) or Nuget packages. The libraries can be published to npm or just be bundled with a deployable application as-is.

The purpose of having libraries is to partition your code into smaller units that are easier to maintain and promote code reuse. They have a well-defined public API described inside the index.ts file, which servers as the entry-point of the library. Thi

@kristofdegrave
kristofdegrave / TableStorageSagaStorage.cs
Last active May 6, 2021 10:15
TableStorageSagaStorage
using Azure;
using Azure.Data.Tables;
using Newtonsoft.Json;
using Rebus.Exceptions;
using Rebus.Sagas;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;