A mixin for writing @font-face rules in SASS.
Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.
@include font-face(Samplino, fonts/Samplino);| // A safe way to call methods in templates | |
| // Live demo @ https://stackblitz.com/edit/angular-generic-map-pipe | |
| import { Pipe, PipeTransform } from "@angular/core"; | |
| // Methods passed to the map pipe cannot (and should not) use the `this` keyword from components. Otherwise, it would not be a pure pipe. | |
| @Pipe({ name: "map" }) | |
| export class MapPipe implements PipeTransform { | |
| public transform<T, R>( | |
| thisArg: T, | |
| project: (t: T, ...others: any[]) => R, |
| fnction AutoUnsub(obs$ = []) { | |
| return function(constructor: any) { | |
| const orig = constructor.prototype.ngOnDestroy | |
| constructor.prototype.ngOnDestroy = function() { | |
| for(const prop in this) { | |
| const property = this[prop] | |
| if(typeof property.unsubscribe === "function" && !obs$.includes(property)) | |
| obs$.push(property) | |
| } | |
| for(const ob$ of obs$) { |
| function drawNestedSetsTree(data, node) { | |
| const ul = document.createElement('ul'); | |
| function nodeHasChildren(node) { | |
| return node.right - node.left == 1 ? false : true; | |
| } | |
| function getChildren(arr, node) { | |
| const children = []; | |
| let childIndex = node.left + 1; |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |