Skip to content

Instantly share code, notes, and snippets.

View kievsash's full-sized avatar
💭
Be honest, be clever

Oleksandr kievsash

💭
Be honest, be clever
View GitHub Profile
@kievsash
kievsash / gist:4c0be8256a44d42bc3b21a39877f1c9c
Created October 19, 2023 09:02
[scss] generate padding classes to be able to assign it for each td (row, column): tr-1-td-3-p0
// https://www.sassmeister.com/ - playground
@for $tr from 1 through 30 {
@for $td from 1 to 30 {
.tr-#{$tr}-td-#{$td}-p0 tr:nth-child(#{$tr}) td:nth-child(#{$td}) {
padding: 0;
}
}
}
/*
@kievsash
kievsash / Mentor It, Blog It, Talk It, Record It.html
Last active January 23, 2020 13:23
Mentor It, Blog It, Talk It, Record It
#Gut feeling
Если вы ещё не нашли своего дела, ищите.
Как это бывает со всеми сердечными делами, вы узнаете, когда найдёте. Не останавливайтесь.
Steve Jobs
#Articles hosting
### medium.com
Publications: Angular in Depth, ITNext, CloudBoost, etc
### dev.to
@kievsash
kievsash / matInput commified.js
Created December 19, 2019 16:52
matInput commified
//html
<input formControlName="account_value"
appCommified
matInput type="text">
//typescript
import {Directive, ElementRef, HostListener, Input} from '@angular/core';
import {MAT_INPUT_VALUE_ACCESSOR} from '@angular/material';
import {numberWithCommas} from '@app/global_helpers';
@kievsash
kievsash / forkJoin with percentage.js
Created May 29, 2019 19:19
forkJoin with percentage
let Rx = window.Rx = window['rxjs'];
let {forkJoin, Subject, merge, of} = Rx;
let {ajax} = Rx.ajax;
let {map, filter, tap, takeLast, scan, startWith} = Rx.operators;
console.clear();
function forkJoinTransparent(arrayOfObservables) {
const emptyArray = Array.from(Array(arrayOfObservables.length));
@kievsash
kievsash / main.ts
Last active May 6, 2019 14:28
main.ts file for stackblitz tests for Angular project
import './polyfills';
// jasmine staff
declare var jasmine;
import jasmineRequire from 'jasmine-core/lib/jasmine-core/jasmine.js';
window['jasmineRequire'] = jasmineRequire;
import 'jasmine-core/lib/jasmine-core/jasmine-html.js';
import 'jasmine-core/lib/jasmine-core/boot.js';
// zone.js testing imports
@kievsash
kievsash / retry+repeat.js
Last active April 26, 2019 15:20
retry+repeat
//js
let Rx = window['rxjs'];
const {defer} = Rx;
const {take, repeat} = Rx.operators;
const {ajax} = Rx.ajax;
console.clear();
let counter=0;
const getData = () => defer(() => ajax('http://localhost:4001/list-data?page='+counter++))
.pipe(retry(2), repeat(2))
@kievsash
kievsash / groupBy.js
Last active January 28, 2019 16:25
groupBy Solution
const selector = (x) => x.userId
const throttleTimeout = 3000;
source$
.pipe(
groupBy(selector),
mergeMap((group$) => group$.pipe(throttleTime(throttleTimeout)))
)
.subscribe(showNotification);
@kievsash
kievsash / groupBy.js
Created January 28, 2019 14:45
groupBy use-case
let Rx = window['rxjs'];
let {from, of, asyncScheduler} = Rx;
let {mergeMap, filter, delay, groupBy, throttleTime} = Rx.operators;
console.clear();
let throttleSelectiveFilter = (throttleTimeout = 0, selector = (x) => x) => {
return (source) => {
return source.pipe(
groupBy(selector),
mergeMap((group$) => group$.pipe(throttleTime(throttleTimeout)))
@kievsash
kievsash / throttleSelectiveFilter with asyncSchedulers.js
Created January 26, 2019 11:41
Throttling notifications from multiple users with RxJS - with throttling by custom throttleSelectiveFilter operator and using asyncSchedulers
let Rx = window['rxjs'];
let {from, of, asyncScheduler} = Rx;
let {mergeMap, filter, delay} = Rx.operators;
console.clear();
let throttleSelectiveFilter = (throttleTime = 0, selector = (x) => x) => {
let setOfEntities = new Set();
return (source) => {
return source.pipe(
filter((notif) => {
@kievsash
kievsash / throttleSelectiveFilter.js
Created January 26, 2019 11:28
Throttling notifications from multiple users with RxJS - with throttling by custom throttleSelectiveFilter operator
let Rx = window['rxjs'];
let {from, of, asyncScheduler} = Rx;
let {mergeMap, filter, delay} = Rx.operators;
console.clear();
let throttleSelectiveFilter = (throttleTime = 0, selector = (x) => x) => {
let setOfEntities = new Set();
return (source) => {
return source.pipe(