Skip to content

Instantly share code, notes, and snippets.

View LayZeeDK's full-sized avatar
🇩🇰
Denmark

Lars Gyrup Brink Nielsen LayZeeDK

🇩🇰
Denmark
View GitHub Profile
@LayZeeDK
LayZeeDK / card.stories.mdx
Created April 6, 2023 14:04
Storybook Angular MDX DocsPage

import { Canvas, Meta, Source, Story } from '@storybook/addon-docs'; import * as stories from './card.stories';

A card is an element which you can put any kind of content inside. Make sure you wrap your content in a <fas-card-section> element in order to achieve the traditional card look.

@LayZeeDK
LayZeeDK / dashboard.component.html
Created February 8, 2023 23:17
Dashboard: Integrated routing component test suite.
<h3>Top Heroes</h3>
<div class="grid grid-pad">
<a
*ngFor="let hero of heroes"
class="col-1-4"
routerLink="/detail/{{ hero.id }}"
>
<div class="module hero">
<h4>{{ hero.name }}</h4>
</div>
@LayZeeDK
LayZeeDK / router-store-notes.md
Last active March 20, 2023 10:26
Router Store notes

Router Store notes

Analysis

Findings

NavigationError

Resets the URL to what it was before the navigation that caused an error. No new navigation is triggered.

URL update strategy

urlUpdateStrategy

  • 'deferred' (the default) updates the browser URL after successful navigation.
@LayZeeDK
LayZeeDK / should-i-use-an-angular-module.md
Created August 23, 2022 08:45
Should I use an Angular module?
graph TD
  A[Should I use an Angular module?] --> B{Is it a component?}
  B -->|Yes| X[Don't use an Angular module]
  B -->|No| C{Is it a directive?}
  C -->|Yes| X
  C -->|No| D{Is it a pipe?}
  D -->|Yes| X
  D -->|No| E{Is it a service?}
 E --&gt;|Yes| X
@LayZeeDK
LayZeeDK / _typescript-utility-types.md
Last active August 26, 2024 20:28
TypeScript utility types

TypeScript utility types

License (MIT)

Copyright 2024 Lars Gyrup Brink Nielsen

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT

@LayZeeDK
LayZeeDK / data-access-allowed-dependencies.md
Last active June 26, 2022 19:54
Nx library types: Allowed dependencies
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#bad6db', 'primaryBorderColor': '#01a9c1', 'primaryTextColor': '#051f34', 'lineColor': '#051f34' }}}%%
graph TD
  data-access --> data-access
  data-access --> util
  data-access --> test-util
@LayZeeDK
LayZeeDK / nx-shared-domain-objects.md
Last active January 25, 2023 08:50
Dependency flow when sharing domain objects in an Nx workspac.e
graph TD;
  feature-->domain
  feature-->dataAccess[data-access]
  dataAccess-->domain
  feature-->ui
  ui-->domain
@LayZeeDK
LayZeeDK / direct-standalone-dependencies.md
Last active June 10, 2022 08:01
Indirect dependencies between components declared by NgModules. Standalone Angular components are easier to understand for both developers and compilers. "imports" means import statements in these diagrams.
  graph TD;
      A[ParentComponent]--imports-->B[ChildComponent];
@LayZeeDK
LayZeeDK / content-child.md
Last active September 16, 2023 21:35
Strict framework-injected properties in Angular components
flowchart TD
    A[ContentChild] --> B;
    B{Is static?} -- No --> C;
    B -- Yes --> D;
    C[Make the query<br>type optional] --> E(Access in<br>ngAfterContentInit<br>or later);
    D(Add assertion<br>in ngOnInit or<br>ngOnChanges) --> F;
    F[Add ! to<br>the query type] --> G(Access in<br>ngOnInit<br>or later)
@LayZeeDK
LayZeeDK / existing resource group with a few changes
Last active April 11, 2022 21:30
az deployment sub what-if
PS> az deployment sub what-if --location westeurope --template-file ./bicep/main.bicep
Note: The result may contain false positive predictions (noise).
You can help us improve the accuracy of the result by opening an issue here: https://aka.ms/WhatIfIssues
Resource and property changes are indicated with these symbols:
+ Create oviders/Microsoft
~ Modify
= Nochange
The deployment will update the following scopes