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
| pattern tap({ next: ..., error: ... }) allows you to handle both success and error scenarios inside the tap operator without needing to use a separate catchError | |
| Before Refactoring (with tap + catchError): | |
| ``` | |
| this.someService.getData().pipe( | |
| tap(data => { | |
| console.log('Data received:', data); | |
| }), | |
| catchError(error => { |
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
| /* | |
| * Total of numbers in an array | |
| */ | |
| const myArray1 = [1, 2, 3, 4, 5, 6, 7]; | |
| const reducedArray = myArray1.reduce((a, b) => a + b, 0) | |
| console.log(reducedArray); | |
| /* | |
| * Turn an array of numbers into a long string of all those numbers |
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
| public static formatDurationms(t: number) { | |
| let h = Math.floor(t / 3600000); | |
| t -= h * 3600000; | |
| let m = Math.floor(t / 60000); | |
| t -= m * 60000; | |
| let s = Math.floor(t / 1000); | |
| let time = ''; |
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
| PPT: https://docs.google.com/presentation/d/1G_zdDOYbCNk1oOacHiV94DpU3jrfwicH/edit | |
| open in html present: https://docs.google.com/presentation/u/0/d/1G_zdDOYbCNk1oOacHiV94DpU3jrfwicH/htmlpresent | |
| Use online tool: https://webtopdf.com/ | |
| options: width, height (px to mm), zoom, page no. | |
| Download |
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 SHOW_DELAY = 1000; | |
| const DISAPPEAR_DELAY = 1000; | |
| @HostListener('mouseenter') | |
| handleMouseEnter() { | |
| let delay = SHOW_DELAY; //1000ms | |
| this.timeoutEnter = this.setTimeout(() => this.setState({isShown: true}), delay); | |
| this.clearTimeout(this.timeoutLeave); |
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'; | |
| @Injectable() | |
| export class IPValidateService { | |
| isIPWithInRange = (ipPartNumber: string) => { | |
| if (isNaN(Number(ipPartNumber))) return false; | |
| if (Number(ipPartNumber) > 255 || Number(ipPartNumber) < 0 || ipPartNumber === '') { | |
| return false; | |
| } | |
| return 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
| Paste here |
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
| -- Remove the history from | |
| rm -rf .git | |
| -- recreate the repos from the current content only | |
| git init | |
| git add . | |
| git commit -m "Initial commit" | |
| -- push to the github remote repos ensuring you overwrite history | |
| git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git |
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
| { | |
| "compilerOptions": { | |
| "module": "commonjs", | |
| "declaration": true, | |
| "noImplicitAny": false, | |
| "removeComments": true, | |
| "noLib": false, | |
| "allowSyntheticDefaultImports": true, | |
| "emitDecoratorMetadata": true, | |
| "experimentalDecorators": 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
| { | |
| "$schema": "node_modules/@angular/cli/lib/config/schema.json", | |
| "version": 1, | |
| "newProjectRoot": "", | |
| "projects": { | |
| "rate-reset": { | |
| "projectType": "application", | |
| "schematics": { | |
| "@schematics/angular:component": { | |
| "style": "scss" |
NewerOlder