Skip to content

Instantly share code, notes, and snippets.

View mattiasnordqvist's full-sized avatar
🚐
____/\___/\_/\____

Mattias Nordqvist mattiasnordqvist

🚐
____/\___/\_/\____
  • Spinit AB
  • Sverige
View GitHub Profile
@mattiasnordqvist
mattiasnordqvist / PersistedQueryNotFoundIsNotAnError
Last active November 30, 2023 21:04
PersistedQueryNotFoundIsNotAnError
// Program.cs
app.UseMiddleware<PersistedQueryNotFoundIsNotAnError.ResponseBodyLoggingMiddleware>();
...
builder.RegisterPersistedQueryNotFoundLogHandling();
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility;
@mattiasnordqvist
mattiasnordqvist / ExampleUsage.cs
Last active November 27, 2021 13:03
The Missing Return Type
public class User
{
public string ConcurrencyToken { get; internal set; }
public Email? Email { get; internal set; }
public Name Name { get; internal set; }
}
public record Email
{
private Email(string value) { Value = value; }
@mattiasnordqvist
mattiasnordqvist / console app
Last active February 4, 2020 10:46
bankapp
static void Main(string[] args)
{
Console.WriteLine($"Enter 'accounts' to see a list of all current balances\nEnter 'log' to see the transaction log\nEnter a transfer command on format 'from -> to: amount' to make a transaction:");
Console.WriteLine();
while (true)
{
Console.Write("> ");
var command = Console.ReadLine();
if(command == "accounts")
{
@mattiasnordqvist
mattiasnordqvist / async-validator-wrapper.ts
Created February 28, 2018 15:23 — forked from Humberd/async-validator-wrapper.ts
Async Validator Wrapper for Angular 2 Reactive Forms.This wrapper lets you debounce your asyncValidator instead of on every keystroke
import { AbstractControl } from "@angular/forms";
import { Observable } from "rxjs/Observable";
import { Subject } from "rxjs/Subject";
export class QstAsyncValidatorWrapper {
/*
* Angular async validators are triggered on every key stroke.
* This function debounces triggering an async validator.
*