This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function AutoUnsubscribe( blackList = [] ) { | |
return function ( constructor ) { | |
const original = constructor.prototype.ngOnDestroy; | |
constructor.prototype.ngOnDestroy = function () { | |
for ( let prop in this ) { | |
const property = this[ prop ]; | |
if ( !blackList.includes(prop) ) { | |
if ( property && ( typeof property.unsubscribe === "function" ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//How To Compare Object Values | |
var a = { blah: 1 }; | |
var b = { blah: 1 }; | |
var c = a; | |
var d = { blah: 2 }; | |
Object.compare = function (obj1, obj2) { | |
//Loop through properties in object 1 | |
for (var p in obj1) { | |
//Check property exists on both objects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addMethod(object, name, fn){ | |
// Save a reference to the old method | |
var old = object[ name ]; | |
// Overwrite the method with our new one | |
object[ name ] = function(){ | |
// Check the number of incoming arguments, | |
// compared to our overloaded function | |
if ( fn.length == arguments.length ) | |
// If there was a match, run the function |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SET WebStormPath=C:\Users\narek\AppData\Local\JetBrains\Toolbox\apps\WebStorm\ch-0\171.3780.41\bin\webstorm64.exe | |
echo Adding file entries | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with WebStorm" /t REG_SZ /v "" /d "Open with WebStorm" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with WebStorm" /t REG_EXPAND_SZ /v "Icon" /d "%WebStormPath%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with WebStorm\command" /t REG_SZ /v "" /d "%WebStormPath% \"%%1\"" /f | |
echo Adding folder entries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Personal(name, age, gender, occupation, hobby) { | |
Person.call(this, name, age, gender); | |
this.occupation = occupation; | |
this.hobby = hobby; | |
} | |
Personal.prototype = Object.create(Person.prototype); | |
Personal.prototype.constructor = Personal; | |
Personal.prototype.incrementAge = function () { | |
Person.prototype.incrementAge.call(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Directive, Output, EventEmitter, ElementRef} from '@angular/core'; | |
import {Observable, Subscription} from "rxjs"; | |
@Directive({ | |
selector: '[appClickOut]' | |
}) | |
export class ClickOutDirective { | |
private listening: boolean; | |
private globalClick: Subscription; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {AbstractControl} from '@angular/forms'; | |
export class PasswordValidation { | |
static MatchPassword(AC: AbstractControl) { | |
let password = AC.get('password').value; // to get value in input tag | |
let confirmPassword = AC.get('confirmPassword').value; // to get value in input tag | |
if(password != confirmPassword) { | |
console.log('false'); | |
AC.get('confirmPassword').setErrors( {MatchPassword: true} ) | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var os = require('os'); | |
var ifaces = os.networkInterfaces(); | |
Object.keys(ifaces).forEach(function (ifname) { | |
var alias = 0; | |
ifaces[ifname].forEach(function (iface) { | |
if ('IPv4' !== iface.family || iface.internal !== false) { |
NewerOlder