Angular 7 Snippets
Angular Language Service
Babel ES6/ES7
Vue Vetur
Sass
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
| import { Directive, forwardRef, ElementRef, Provider, OnDestroy } from '@angular/core'; | |
| import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; | |
| export const STENCIL_VALUE_ACCESSOR: Provider = { | |
| provide: NG_VALUE_ACCESSOR, | |
| useExisting: forwardRef(() => StencilDirective), | |
| multi: true | |
| }; |
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
| function getMock<T>(partial: Partial<T>): T { | |
| return { ...partial } as T; | |
| } |
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
| import { Injectable } from "@angular/core"; | |
| /** | |
| * Angular scroll service | |
| */ | |
| @Injectable({ | |
| providedIn: "root" | |
| }) | |
| export class ScrollService { |
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
| import { Pipe, PipeTransform } from '@angular/core'; | |
| /** | |
| * Debug pipe to debug template statements. | |
| * It will always return the value it gets passed, so we can pipe it along with other pipes. | |
| * | |
| * @example | |
| * ``` | |
| <!-- only log to console --> | |
| <compA [binding]= "someObj | smtDebug"></compA> |
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
| // source: http://lacie.nas-central.org/wiki/Enabling_ssh_through_uploading_a_PHP_script_(Network_space_2) | |
| <?php | |
| /****************************************************** | |
| * Enable SSH root access on Lacie Network Space 2 (v1.0.2 & v1.2.5) | |
| * | |
| * - Use puttygen to create a public/private key pair | |
| * - Save the public and private key to your computer | |
| * - Copy the key from the puttygen box "Public key for pasting into OpenSSH authorized_keys file" | |
| * - Paste the key into this script in the $sshkey variable below. |
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
| .rainbow { | |
| background-image: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); | |
| width: 100%; | |
| height: 60px; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| // draws a grid |
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
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Launch Chrome", | |
| "type": "chrome", | |
| "request": "launch", | |
| "url": "http://localhost:4200/", | |
| "runtimeArgs": [ | |
| "--user-data-dir=c:\\temp\\ngx-components", |
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
| const stringify = JSON.stringify; | |
| JSON.stringify = (data) => { | |
| try { | |
| return stringify(data); | |
| } catch(ex) { | |
| debugger; | |
| } | |
| }; |
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
| @NgModule({ | |
| imports: [ | |
| ... | |
| ], | |
| providers: [ | |
| ... | |
| ], | |
| exports: [ | |
| ... | |
| ] |
NewerOlder