Skip to content

Instantly share code, notes, and snippets.

View ZeevKatz's full-sized avatar
💻

Zeev Katz ZeevKatz

💻
View GitHub Profile
@Rehooktive(Hook.OnChanges)
private readonly onChanges$: Observable<SimpleChanges>;
constructor() {
this.onChanges$
.pipe(
pluck('events'),
filter<SimpleChange>(Boolean),
switchMap(events => this.registerEvents(events.currentValue))
)
@Rehooktive(Hook.OnChanges)
private readonly onChanges$: Observable<SimpleChanges>;
ngOnChanges({ events }: SimpleChanges) {
if (events) {
this.registerEvents(this.events)
.pipe(takeUntil(this.onChanges$))
.subscribe(event => this.logEvent(event, this.properties));
}
}
private readonly onChanges$$ = new Subject();
private readonly onChanges$ = this.onChanges$$.pipe();
ngOnChanges({ events }: SimpleChanges) {
this.onChanges$$.next();
if (events) {
this.registerEvents(this.events)
.pipe(
takeUntil(this.onChanges$),
<toolbar (editChange)="isEditMode = $event"></toolbar>
<text-editor analytics
[edit]="isEditMode"
[events]="isEditMode ? ['contextmenu', 'focus'] : ['focus']">
</text-editor>
private registeredEventsSubscription: Subscription;
ngOnChanges({ events }: SimpleChanges) {
if (events) {
this.unsubscribeRegisteredEvents();
this.registeredEventsSubscription = this.registerEvents(this.events)
.pipe(untilDestroyed(this))
.subscribe(event => this.logEvent(event, this.properties));
}
}
/**
* Supported events for analytics.
*/
export type AnalyticsEvent = 'click' | 'focus' | 'blur';
/**
* Directive that used to log client events to the analytics provider by using {@link AnalyticsService}.
*/
@Directive({ selector: '[analytics]' })
export class AnalyticsDirective implements OnChanges {
@Directive({
selector: "[mouse]",
exportAs: "mouse"
})
export class MouseComponent {
private _state = { x: 0, y: 0 };
get state() {
return this._state;
}
st = status
s = switch
cp = cherry-pick
cpc = cherry-pick --continue
cps = cherry-pick --skip
cpa = cherry-pick --abort
rbc = rebase --continue
rbs = rebase --skip
rba = rebase --abort
bm = "!f() { git branch -m "$1"; }; f"