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
https://github.com/welldone-software/why-did-you-render |
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
const actualSymbolsFromStore: Symbol[] = yield select(SymbolSelectors.byServerIdPresetId(serverId, presetId)); | |
const oldSymbolsFromModelTypes: Symbol[] = modelTypes[0].symbols; | |
// Change order | |
const takeActualSymbols: Symbol[] = actualSymbolsFromStore.filter((actualSymbol) => | |
oldSymbolsFromModelTypes.find((oldSymbol) => actualSymbol.id === oldSymbol.id), | |
); | |
or |
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
const [containerHeight, setContainerHeight] = useState<number>(0); | |
const containerHeightRef = useCallback((node) => { | |
if (node !== null) { | |
setContainerHeight(node.getBoundingClientRect().height); | |
} | |
}, []); | |
<div ref={containerHeightRef}></div> |
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
selectedColor: FormControl = new FormControl({value: '', disabled: true}); | |
(value !== '') ? this.selectedColor.enable() : this.selectedColor.disable(); | |
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
// Listen scroll | |
@HostListener('window:scroll', ['$event']) | |
test() { | |
let pos: number = document.documentElement.scrollTop + document.documentElement.offsetHeight; | |
let max: number = document.documentElement.scrollHeight; | |
if ((max - pos) < 200) { |
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
let arr1 = [ | |
{id: "pduutGbL2-M", isChecked: true}, | |
{id: "J6MJPuJiDPo", isChecked: true} | |
] | |
let arr2 = [ | |
{id: "pduutGbL2-M", isChecked: false}, | |
{id: "J6MJPuJiDPo", isChecked: false}, | |
{id: "WD6jyaFrVM8", isChecked: false}, | |
{id: "ULP07chR5EQ", isChecked: false} |
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 for output data | |
import {Component, OnInit} from '@angular/core'; | |
import {PictureDate, PictureService} from '../../services/picture.service'; | |
import {StateService} from '../../services/state.service'; | |
@Component({ | |
selector: 'app-home-page', | |
templateUrl: './home-page.component.html', |
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
(change)="showOptions($event)" | |
showOptions(event:MatCheckboxChange): void { | |
console.log(event.checked); | |
} |
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
// Create interfaces for type | |
interface Urls { | |
small: string; | |
regular: string; | |
} | |
export interface PictureDate { | |
id: string; | |
urls: Urls; |
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 sound from "./source/filename.mp3" | |
let audio = new Audio(sound); | |
audio.play(); |
NewerOlder