Skip to content

Instantly share code, notes, and snippets.

View alx8437's full-sized avatar
👨‍💻

Aleksandr alx8437

👨‍💻
View GitHub Profile
https://github.com/welldone-software/why-did-you-render
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
const [containerHeight, setContainerHeight] = useState<number>(0);
const containerHeightRef = useCallback((node) => {
if (node !== null) {
setContainerHeight(node.getBoundingClientRect().height);
}
}, []);
<div ref={containerHeightRef}></div>
selectedColor: FormControl = new FormControl({value: '', disabled: true});
(value !== '') ? this.selectedColor.enable() : this.selectedColor.disable();
// 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) {
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}
// 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',
(change)="showOptions($event)"
showOptions(event:MatCheckboxChange): void {
console.log(event.checked);
}
// Create interfaces for type
interface Urls {
small: string;
regular: string;
}
export interface PictureDate {
id: string;
urls: Urls;
import sound from "./source/filename.mp3"
let audio = new Audio(sound);
audio.play();