Skip to content

Instantly share code, notes, and snippets.

View KevinValmo's full-sized avatar
🎯
Focusing

Kevin Valmorbida KevinValmo

🎯
Focusing
View GitHub Profile
@KevinValmo
KevinValmo / log.pipe.ts
Created October 21, 2022 15:35
Build a piper used to console log an object. Log an object from html template in Angular.
/**
* A pipe used to console log an object.
*/
@Pipe({
name: 'log',
})
export class LogPipe implements PipeTransform {
public transform(object: any) {
console.log(object);
}
@KevinValmo
KevinValmo / fade-in-out.css
Created August 27, 2022 16:26
A simple css selector animation to fade in and out.
.fade-in-10 {
animation: fadeIn 0.1s;
}
.fade-in-30 {
animation: fadeIn 0.3s;
}
.fade-in-50 {
animation: fadeIn 0.5s;
}
.fade-in-100 {
@KevinValmo
KevinValmo / solid-principles.md
Created July 9, 2022 13:09
A brief description of the SOLID principles.

S.O.L.I.D. principles

Author: Kevin Valmorbida

S - Single Responsibility Principle

A class should have a single responsibility. Not more than one job or a strict subset of it should be done by a class.

SRP

@KevinValmo
KevinValmo / src1.md
Created June 27, 2022 16:08
Single responsability principle example 1

The SRP - Single Resposibility Principle

Example 1

A class should be responsible to one and only one behavior.

The Person is a model with an Identifier property PersonId. The class PersonIdGenerator is responsible only for generating the Person Identifier.

@KevinValmo
KevinValmo / FooBar.cs
Created June 8, 2022 10:30
Compiler rise CS8618 when it should not. I guess.
using System;
namespace FooBar.Models;
public class Foo
{
public string Name { get; set; }
public Foo(Action<Foo> options) // CS8618
{
@KevinValmo
KevinValmo / entity.ts
Last active June 7, 2022 23:24
Smart constructor that does not compile
export class Entity {
public name: string;
public description: string;
constructor(options: (entity: Entity) => void)
{
options(this);
}
}