Skip to content

Instantly share code, notes, and snippets.

@nakulvijay56
nakulvijay56 / regex-remove.ts
Last active March 2, 2020 11:08
Angular : This is a custom directive to remove matching regex pattern from ngModel inputs
import { Directive, HostListener, Input, OnChanges, Optional } from '@angular/core';
import { NgModel } from '@angular/forms';
/**
* @description
*
* This is a custom directive to remove matching regex pattern from ngModel inputs
*
* eg:
* (will remove character matching the default regular expression present in the directive)
@nakulvijay56
nakulvijay56 / javascript-log-wrapping.md
Created August 18, 2020 07:13 — forked from robatron/javascript-log-wrapping.md
Wrapping `console.log` (et al.) in your own function to modify logging behavior.

JavaScript Log Wrapping

Wrapping console.log (et al.) in your own function to modify logging behavior.

Why?

You may want a simple way to:

@nakulvijay56
nakulvijay56 / Javascript ISO country code to country name conversion
Created August 27, 2020 14:39 — forked from maephisto/Javascript ISO country code to country name conversion
ISO 3166-1 alpha-2 country code to country name conversion with a simple Javascript implementation, an array and a function.
var isoCountries = {
'AF' : 'Afghanistan',
'AX' : 'Aland Islands',
'AL' : 'Albania',
'DZ' : 'Algeria',
'AS' : 'American Samoa',
'AD' : 'Andorra',
'AO' : 'Angola',
'AI' : 'Anguilla',
'AQ' : 'Antarctica',

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.