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
interface Walkable { | |
walk(): void; | |
} | |
interface Flyable { | |
fly(): void; | |
} | |
class Dog implements Walkable { | |
walk() { |
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
abstract class Animal { | |
abstract move(): void; | |
} | |
class Mammal extends Animal { | |
move() { | |
// Move in 2d space | |
} | |
} |
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
... | |
@Component({ | |
... | |
}) | |
export class AppComponent implements OnInit{ | |
constructor(private readonly http: HttpClient) { | |
} | |
ngOnInit() { |
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
export function* chunks<T>(values: T[], size = 1): Generator<T[]> { | |
for (let index = 0; index < values.length; index += size) { | |
yield values.slice(index, index + size); | |
} | |
} |
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
... | |
COPY package*.json ./ | |
RUN --mount=type=secret,id=npmrc,target=/usr/local/app/.npmrc \ | |
npm ci | |
... |
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 { filter, map, Observable, OperatorFunction } from 'rxjs'; | |
export function nonNullable<T>(): OperatorFunction<T, NonNullable<T>> { | |
return function (source$: Observable<T>): Observable<NonNullable<T>> { | |
return source$.pipe( | |
filter((value): value is T => value != null) | |
); | |
}; | |
} |
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
export class Batches<T> implements Iterable<T[]> { | |
constructor(private values: T[], private size: number) { | |
} | |
[Symbol.iterator](): Iterator<T[]> { | |
return new BatchesIterator(this.values, this.size); | |
} | |
} | |
class BatchesIterator<T> implements Iterator<T[]> { |