Skip to content

Instantly share code, notes, and snippets.

View Muzammil-Bilwani's full-sized avatar
🎯
Focusing

Muzammil Bilwani Muzammil-Bilwani

🎯
Focusing
View GitHub Profile
@Muzammil-Bilwani
Muzammil-Bilwani / aas
Last active February 10, 2018 15:19
asd
## Comparision
| | for..in | for..of |
|------|------ | ------ |
| Applies to | Enumerable Properties | Iterable Collections |
| Use with Objects? | Yes | No |
| Use with Arrays? | Yes, but not advised | Yes |
| Use with Strings? | Yes, but not advised | Yes |
@Muzammil-Bilwani
Muzammil-Bilwani / ubuntu-setup.md
Last active July 9, 2018 16:44
Setup commands for Ubuntu

Installation For Ubuntu

Node JS

curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs 

Git

sudo apt install git-all
// Number 1
function greetings (name) {
return 'hello ' + name
}
// Number 2
var obj1 = { a: 1, b: 2 }
var obj2 = { a: 2, c: 3, d: 4}
@Muzammil-Bilwani
Muzammil-Bilwani / Breadcrumb.component.ts
Last active November 8, 2018 08:58
Breadcrumbs for Angular
ngOnInit() {
this.breadcrumbs$ = this.router.events.pipe(
filter(event => event instanceof NavigationEnd),
distinctUntilChanged(),
map(event => {
return this.buildBreadCrumb(this.activatedRoute.root)
})
);
//Build your breadcrumb starting with the root route of your current activated route
@Muzammil-Bilwani
Muzammil-Bilwani / component.ts
Created November 10, 2018 09:09
Title of routing page using angular
this._router.events.pipe(
filter((event) => event instanceof NavigationEnd)
, map(() => this.activatedRoute)
, map((route) => {
while (route.firstChild) route = route.firstChild;
return route;
})).pipe(
filter((route) => route.outlet === 'primary')
, mergeMap((route) => route.data))
.subscribe((event) => this.title = event.title);
@Directive({
// tslint:disable-next-line:directive-selector
selector: "[OnlyNumber]"
})
export class OnlyNumberDirective {
constructor(private el: ElementRef) { }
@Input() OnlyNumber: boolean;
@Muzammil-Bilwani
Muzammil-Bilwani / draggable.ts
Created November 29, 2018 05:51
Drag a modal with a dragger Directive in angular
@Directive({
// tslint:disable-next-line:directive-selector
selector: "[draggable]"
})
export class DraggableDirective implements AfterViewInit, OnDestroy {
@Input() dragHandle: string;
@Input() dragTarget: string;
@Muzammil-Bilwani
Muzammil-Bilwani / any.html
Created December 5, 2018 05:53
For Infinite Scroll with RxJs
<!-- #scrollMe [scrollTop]="scrollMe.scrollHeight" remove this for normal scroll -->
<div class="comment-list" #scrollMe [scrollTop]="scrollMe.scrollHeight" infiniteScroll scrollPerecnt="20"
[immediateCallback]="true" [scrollCallback]="scrollCallback">
@Muzammil-Bilwani
Muzammil-Bilwani / copyPasteBlock.ts
Created July 8, 2019 13:14
Block Copy Paste in Angular for Input fields
import { Directive, HostListener } from '@angular/core';
@Directive({
selector: '[CopyPasteBlock]'
})
export class CopyPasteBlockDirective {
constructor() { }
@HostListener('paste', ['$event']) blockPaste(e: KeyboardEvent) {
@Muzammil-Bilwani
Muzammil-Bilwani / morgan_template.ts
Last active April 14, 2020 09:21
Morgan template
import morgan from "morgan";
import e from "express";
const loggerTemplate = (
tokens: morgan.TokenIndexer,
req: e.Request,
res: e.Response
) =>
[
tokens.method(req, res),