Skip to content

Instantly share code, notes, and snippets.

View a-patel's full-sized avatar
👨‍💻
while (!sleep) { learn(); }

Ashish Patel a-patel

👨‍💻
while (!sleep) { learn(); }
View GitHub Profile
@a-patel
a-patel / AutofacValidatorFactory.cs
Created August 10, 2016 16:48 — forked from jasonmitchell/AutofacValidatorFactory.cs
Integrating Fluent Validation with Web API using Autofac. Full example: https://github.com/jasonmitchell/fluentvalidation-webapi-autofac
using System;
using Autofac;
using FluentValidation;
namespace Sample.Web.Infrastructure
{
public class AutofacValidatorFactory : ValidatorFactoryBase
{
private readonly IComponentContext _context;
@a-patel
a-patel / gist:444d2c7c1f5e3c260cfaaf5f012d40c2
Created August 28, 2016 11:42 — forked from dalager/gist:842109
Log.cs - log4net wrapper
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using log4net;
using log4net.Config;
namespace Core
{
/// <summary>

Nopcommerce Developer Guide==============================>>> DOWNLOAD <<<==============================Nopcommerce Developer GuideSPIDER BEARING U JOINT 4206070230 KAWASAKI 85Z 42060 you have registered with across Africa. John Deere A B International july4th National Holidays Recipes Religious Uncategorized. Various embodiments of the present invention are set Mini Exavator Illustrated Parts figures and in the Updated: Recurrent lip swelling invention as provided herein of Ka

@a-patel
a-patel / Example1.cs
Created August 31, 2017 09:49 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@a-patel
a-patel / meta-tags.md
Created September 2, 2018 16:40 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@a-patel
a-patel / CustomerController.cs
Last active September 16, 2018 13:36
LiteX Cache
/// <summary>
/// Customer controller
/// </summary>
[Route("api/[controller]")]
public class CustomerController : Controller
{
#region Fields
private readonly ILiteXCacheManager _cacheManager;
@a-patel
a-patel / error.handler.ts
Created November 16, 2018 18:06
Error Handler in Angular
import { ErrorHandler, Injectable, Injector } from "@angular/core";
import { Router } from "@angular/router";
import { ModalService } from "../services/modal.service";
@Injectable()
export class CustomErrorHandler implements ErrorHandler {
constructor(private readonly injector: Injector) { }
handleError(error: any) {
const modalService = this.injector.get(ModalService);
@a-patel
a-patel / authentication.guard.ts
Created November 16, 2018 18:13
Authentication Guard in Angular
import { Injectable } from "@angular/core";
import { CanActivate, Router } from "@angular/router";
import { TokenService } from "../services/token.service";
@Injectable()
export class AuthenticationGuard implements CanActivate {
constructor(
private readonly router: Router,
private readonly tokenService: TokenService) { }
@a-patel
a-patel / http.interceptor.ts
Last active November 16, 2018 18:17
HTTP Interceptor in Angular
import { HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { TokenService } from "../services/token.service";
@Injectable()
export class CustomHttpInterceptor implements HttpInterceptor {
constructor(private readonly tokenService: TokenService) { }
intercept(request: HttpRequest<any>, next: HttpHandler) {
let url = request.url;
@a-patel
a-patel / handlers.module.ts
Created November 16, 2018 18:37
Global Error Handling in Angular
import { ErrorHandler, NgModule } from "@angular/core";
import { CustomErrorHandler } from "./error.handler";
@NgModule({
providers: [
{ provide: ErrorHandler, useClass: CustomErrorHandler }
]
})
export class HandlersModule { }