Skip to content

Instantly share code, notes, and snippets.

View IMZihad21's full-sized avatar
🇧🇩

ZèD IMZihad21

🇧🇩
View GitHub Profile
@IMZihad21
IMZihad21 / AutoFacModule.cs
Created August 30, 2023 16:47 — forked from thiagomajesk/AutoFacModule.cs
Generic Handlers & Commands for MediatR (+ AutoFac config)
public class GenericHandlersModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<CreateCommandHandler<Foo, CreateFooCommand>>().As<IRequestHandler<CreateFooCommand, bool>>();
builder.RegisterType<DeleteCommandHandler<Foo, DeleteFooCommand>>().As<IRequestHandler<DeleteFooCommand, bool>>();
builder.RegisterType<ListQueryHandler<Foo, ListFooQuery>>().As<IRequestHandler<ListFooQuery, IEnumerable<Foo>>>();
builder.RegisterType<UpdateCommandHandler<Foo, UpdateFooCommand>>().As<IRequestHandler<UpdateFooCommand, bool>>();
}
}
@IMZihad21
IMZihad21 / reduce_Object.md
Created August 23, 2022 05:44 — forked from jrrio/reduce_Object.md
Calculate the average of Object properties using for...in loop, Object.keys(), Object.values(), and Object.entries()

Calculate the average of Object properties

Here is our Object literal with some properties. What we need to do is calculate the average height of a set of people using JavaScript.

const data = {
  "Matt": { "height" : 176, "weight": 87 },
  "Jason": { "height" : 190, "weight": 103 },
  "Peter": { "height" : 180, "weight": 98 }
};