Skip to content

Instantly share code, notes, and snippets.

View ravindUwU's full-sized avatar
😴
eepy

Ravindu Liyanapathirana ravindUwU

😴
eepy
View GitHub Profile
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))]
/**
* 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"]');
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")]
// 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();
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;
};
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@keyframes fade-in {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}