This file contains hidden or 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
type Increment<N extends number, Arr extends any[] = []> = Arr['length'] extends N | |
? [...Arr, any]['length'] | |
: Increment<N, [...Arr, any]>; | |
type FilteredKeys<T> = Exclude<keyof T, keyof any[]>; | |
type DeepKeysPrefix<T, K extends keyof T, MaxDepth extends number, Depth extends number> = Depth extends MaxDepth | |
? never | |
: K extends string | number | |
? `${K}.${DeepKeys<T[K], MaxDepth, Increment<Depth>> & string}` |
This file contains hidden or 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
/* | |
Strategy Pattern | |
Co-Author: https://github.com/WaseemMansour | |
reference: https://refactoring.guru/design-patterns/strategy | |
*/ | |
/* Strategies context */ | |
class Context<Strategy> { | |
/* reference to concrete strategy */ | |
private strategy: Strategy; |
This file contains hidden or 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
sudo apt update | |
# docker | |
curl -fsSL https://get.docker.com -o get-docker.sh | |
sudo sh get-docker.sh | |
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
newgrp docker | |
# docker-compose |
This file contains hidden or 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
class Adult { | |
age: AdultAge; | |
constructor(age: AdultAge) { | |
this.age = age; | |
} | |
} | |
/* value object */ | |
class AdultAge { |
This file contains hidden or 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
<?php | |
/* | |
* Send HTML Emails with inline images | |
*/ | |
class Custom_Mailer | |
{ | |
public $email_attachments = []; | |
public function send($to, $subject, $body, $headers, $attachments) |