Skip to content

Instantly share code, notes, and snippets.

View RomanVavryn's full-sized avatar

Roman Vavrynkevych RomanVavryn

View GitHub Profile
@RomanVavryn
RomanVavryn / Stop async function for some time
Created February 6, 2024 07:46
Stop async function for some time
async function myAsyncFunction() {
console.log('Start of async function');
// Your asynchronous code here
// Introduce a delay of 5 seconds
await new Promise(resolve => setTimeout(resolve, 5000));
console.log('End of async function');
}
@RomanVavryn
RomanVavryn / Control Value Accessor
Created October 8, 2022 09:54
Control Value Accessor
https://www.youtube.com/watch?v=EY0Nw06xyt8
https://www.youtube.com/watch?v=5xxMBOE3LNs
@RomanVavryn
RomanVavryn / Angular Material Datepicker with custom formating, locale using date-fns
Last active October 5, 2022 11:56
Angular Material Datepicker with custom formating, locale using date-fns
https://stackoverflow.com/questions/71603404/rangeerror-locale-must-contain-localize-property-when-using-angular-material-da
import { es } from 'date-fns/locale';
let matLocale = es;
let dateInput = "DD/MM/YYYY";
export const MY_DATE_FORMATS: MatDateFormats = {
parse: {
dateInput: dateInput,
@RomanVavryn
RomanVavryn / Angular параллельные и последовательные запросы на RxJS
Created March 17, 2022 14:00
Angular параллельные и последовательные запросы на RxJS
https://tyapk.ru/blog/post/rxjs-angular-parallelnye-i-posledovatelnye-zaprosy
@RomanVavryn
RomanVavryn / Angular dinamic component: video instruction(ru)
Created February 16, 2022 08:22
Angular dinamic component: video instruction(ru)
https://www.youtube.com/watch?v=J-SAXiEh6FM
https://angdev.ru/doc/dynamic-components/
https://angular.io/guide/dynamic-component-loader
@RomanVavryn
RomanVavryn / Angular How to listen for keypress event on the whole page
Last active February 11, 2022 12:44
Angular How to listen for keypress event on the whole page
https://stackoverflow.com/questions/37362488/how-can-i-listen-for-keypress-event-on-the-whole-page/37363257
1--------------------------------------------------------------------
https://angular.io/api/core/HostListener
I would use @HostListener decorator within your component:
import { HostListener } from '@angular/core';
@Component({
...
@RomanVavryn
RomanVavryn / Angular primeNG p-table export to csv compatible with excel supports Cyrillic text
Last active January 25, 2022 14:31
Angular primeNG p-table export to csv compatible with excel supports Cyrillic text
// imports
import { ObjectUtils } from 'primeng/utils';
import * as FileSaver from 'file-saver';
// method
saveAsCSVExcelFile(): void {
const columns: any = this.viewData.colDefs;
const data: any = this.viewData.rowData;
let csv: string = '';