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
var Singleton = (function () { | |
var instance; | |
function createInstance() { | |
var object = new Object("I am the instance"); | |
return object; | |
} | |
return { | |
getInstance: 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
const add = (function () { | |
let counter = 0; | |
return function () {counter += 1; return counter;} | |
})(); | |
add(); | |
// Example Explained | |
// The variable add is assigned to the return value of a self-invoking 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
import { ApplicationRef, DoBootstrap, NgModule } from '@angular/core'; | |
import { BrowserModule } from '@angular/platform-browser'; | |
import { AppComponent } from './app.component'; | |
import { SecondaryComponent } from './secondary/secondary.component'; | |
@NgModule({ | |
imports: [BrowserModule], | |
declarations: [AppComponent, SecondaryComponent], | |
entryComponents: [AppComponent, SecondaryComponent] |
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 { NgModule, Injectable } from '@angular/core'; | |
import { RouterModule, Routes, PreloadingStrategy, Route } from '@angular/router'; | |
import { Observable, of, timer } from 'rxjs'; | |
import { flatMap } from 'rxjs/operators' | |
// Modules will current route will load immediately | |
const routes: Routes = [ | |
{ | |
path: 'auth', |
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
[ | |
{ | |
"name": "Afghanistan", | |
"code": "AF", | |
"capital": "Kabul", | |
"region": "AS", | |
"currency": { | |
"code": "AFN", | |
"name": "Afghan afghani", | |
"symbol": "؋" |
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
[ | |
{ | |
"id": "1", | |
"type": "Union Territory", | |
"capital": "Mayabunder", | |
"code": "AN", | |
"name": "Andaman and Nicobar Islands", | |
"districts": [ | |
{ | |
"id": "1", |
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
[ | |
{ | |
"id": "1", | |
"name": "Mumbai", | |
"state": "Maharashtra" | |
}, | |
{ | |
"id": "2", | |
"name": "Delhi", | |
"state": "Delhi" |
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
[ | |
{ | |
"name": "Ascension Island", | |
"code": "AC", | |
"emoji": "🇦🇨", | |
"unicode": "U+1F1E6 U+1F1E8", | |
"image": "https://cdn.jsdelivr.net/npm/country-flag-emoji-json@2.0.0/dist/images/AC.svg" | |
}, | |
{ | |
"name": "Andorra", |
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
// Custom validators, email, max minlength, password for Reactive forms in Angular | |
// Form Group | |
this.reactiveForm = this.formBuilder.group({ | |
first_name: ['', [Validators.required,Validators.minLength(3),Validators.maxLength(50)]], | |
last_name: ['', [Validators.required,Validators.minLength(3),Validators.maxLength(50)]], | |
phone: ['', [Validators.required,ValidationService.checkLimit(5000000000,9999999999)]], | |
email: ['', [Validators.required, ValidationService.emailValidator]] | |
}); | |
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
<?php | |
$to = "someone@example.com, someone2@example.com"; | |
$subject = "HTML email"; | |
$message = " | |
<html> | |
<head> | |
<title>Sample HTML email</title> | |
</head> | |
<body> |
OlderNewer