This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Linq; | |
using System.Linq.Expressions; | |
using System.Threading.Tasks; | |
[Table("entity")] | |
[PrimaryKey(nameof(Id))] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Finds the <link>ed PWA manifest (https://developer.mozilla.org/docs/Web/Manifest) and changes its | |
* properties. Then, updates the <link> to a data URL with the contents of the changed manifest. | |
* | |
* It's possible that this might prevent manifest updates (https://web.dev/articles/manifest-updates) | |
* but I'm unsure; haven't investigated this. | |
*/ | |
(async () => { | |
// Get manifest JSON. | |
const link = document.querySelector('link[rel="manifest"]'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.Logging; | |
using System; | |
using System.ComponentModel.DataAnnotations.Schema; | |
using System.Linq; | |
using System.Threading.Tasks; | |
public partial class Program | |
{ | |
[Table("entity")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Context: | |
// - Invoked within `OnModelCreating(ModelBuilder modelBuilder)`. | |
// - `entity` is an `IMutableEntityType`, obtained by iterating `modelBuilder.Model.GetEntityTypes()`. | |
// - `builder` is an `EntityTypeBuilder`, obtained by calling `modelBuilder.Entity(string name)`. | |
// Find [Key] properties of the entity. | |
var keys = entity.GetProperties() | |
.Where((p) => p.PropertyInfo?.GetCustomAttribute<KeyAttribute>() is not null) | |
.ToList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OnChanges, SimpleChange, SimpleChanges } from '@angular/core'; | |
/** | |
* {@link SimpleChange}, but with typed previous & current values. | |
*/ | |
export type TypedChange<T> = Omit<SimpleChange, 'previousValue' | 'currentValue'> & { | |
previousValue: T; | |
currentValue: T; | |
firstChange: boolean; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
@keyframes fade-in { | |
0% { | |
opacity: 0; | |
} | |
100% { | |
opacity: 1; | |
} | |
} |