Skip to content

Instantly share code, notes, and snippets.

View ntxinh's full-sized avatar
💭
❤️ .NET & JavaScript

Xinh Nguyen ntxinh

💭
❤️ .NET & JavaScript
View GitHub Profile
@ntxinh
ntxinh / FluentValidationAlternative.cs
Created January 8, 2024 09:42 — forked from olivier5741/FluentValidationAlternative.cs
An alternative library API to FluentValidation
namespace Validation.Tests
{
using System;
using System.Collections.Generic;
using Xunit;
public class User
{
public string Name { get; set; }
public int Age { get; set; }
@ntxinh
ntxinh / unsaved-changes-guard.ts
Created October 3, 2019 04:41 — forked from Splaktar/unsaved-changes-guard.ts
Guard against navigating away when there are unsaved changes
import {CanDeactivate, Router} from '@angular/router';
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {Observer} from 'rxjs/Observer';
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
export interface CanComponentDeactivate {
canDeactivate: () => Observable<boolean> | Promise<boolean> | boolean;
}