Skip to content

Instantly share code, notes, and snippets.

View PradeepLoganathan's full-sized avatar

Pradeep Loganathan PradeepLoganathan

View GitHub Profile
private byte[] GeneratePasswordHash(string Password, byte[] SaltBytes)
{
byte[] HashedPassword;
Rfc2898DeriveBytes Pbkdf2 = new Rfc2898DeriveBytes(Password, SaltBytes, HashIterationCount);
HashedPassword = Pbkdf2.GetBytes(DerivedKeyLength);
return HashedPassword;
}
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/PradeepLoganathan/Multiauth.git", "c:/sources/repos/Multiauth");
});
RunTarget("Git-Clone");
@PradeepLoganathan
PradeepLoganathan / Guard.cs
Last active May 19, 2019 00:30
C# Guard class with common validation checks.
public static class Guard
{
public static void AgainstNull<T>(T value)
where T : class
{
if (value == null)
throw new ArgumentNullException();
}
public static void AgainstNull<T>(T value, string paramName)

Angular Interview Questions

Some basic questions going from easy to difficult. A more exhaustive list of more questions from the community can be found here.

Easy

  • Whats the difference between components and directives? [ANSWER]: Components are widgets while directives more like decorators for elements and/or components.
  • How do you get a reference to a child component? [ANSWER]: ViewChild/ViewChildren or ContentChild/ContentChildren
  • What is the difference between ViewChild and ContentChild?
  • Whats the difference between NgModules and ES2015 Modules?
  • How do you lazy load components and why is lazy loading important?
  • Explain Observables and why they are useful.
export const environment = {
production: false
};
@PradeepLoganathan
PradeepLoganathan / angular-cli.json
Last active February 13, 2018 16:57
.angular-cli.json file with multiple environments.
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.dev.ts",
"prod": "environments/environment.prod.ts",
"stage":"environments/environment.stage.ts"
}
import { Injectable, OnInit } from "@angular/core";
import { HttpClient, HttpErrorResponse, HttpHeaders } from '@angular/common/http';
import { Observable } from "rxjs/Observable";
import { ErrorObservable } from 'rxjs/observable/ErrorObservable';
import { catchError, tap } from 'rxjs/operators';
@Injectable()
export class ProductsService {
productsUrl:string = 'http://theproductsapi.com/api/products';
@PradeepLoganathan
PradeepLoganathan / startup.cs
Created February 17, 2018 14:38
CORS configuration
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
@PradeepLoganathan
PradeepLoganathan / ProductsManager.ts
Last active March 13, 2018 06:02
A component which uses the subscription service
import { Observable } from "rxjs/Observable";
import { Subscription } from "rxjs/Subscription";
import { IProduct } from "../../models/subscription.Models/Products/Core/IProduct";
import { ProductService } from "../../core/services/ProductService/product.service";
@Component({
selector: "app-product-manager",
templateUrl: "./productmanager.component.html",
styleUrls: ["./productmanager.component.css"]
@PradeepLoganathan
PradeepLoganathan / Program.cs
Last active May 9, 2018 13:02
OWIN Server and building them using WebHostBuilder.
using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace OWINHost
{
class Program
{
static void Main(string[] args)
{
var host = new WebHostBuilder()