Skip to content

Instantly share code, notes, and snippets.

Pradeep Loganathan PradeepLoganathan

View GitHub Profile
PradeepLoganathan / poddef.json
Created Jan 13, 2019
pod definition - Yaml definition of a pod.
View poddef.json
"apiVersion": "v1",
"kind": "Pod",
"metadata": {
"creationTimestamp": "2019-01-12T18:19:02Z",
"generateName": "docone-deployment3-6594cdc4d-",
"labels": {
"pod-template-hash": "6594cdc4d",
"run": "docone-deployment3"
PradeepLoganathan / Eventschema.json
Created Dec 30, 2018
Azure event grid - Event Schema
View Eventschema.json
"topic": "string",
"subject": "string",
"id": "string",
"eventType": "string",
"eventTime": "string",
"data": { "object-unique-to-each-publisher" },
"dataVersion": "string",
"metadataVersion": "string"
PradeepLoganathan / AzureEventGridEventHandler.cs
Last active Dec 31, 2018
Azure Event grid - Custom event handler
View AzureEventGridEventHandler.cs
public async Task<IActionResult> Post([FromBody]object request)
var eventGridEvent = JsonConvert.DeserializeObject<EventGridEvent[]>(request.ToString());
foreach (var item in eventGridEvent)
if (string.Equals(item.EventType, "Microsoft.EventGrid.SubscriptionValidationEvent", StringComparison.OrdinalIgnoreCase))
PradeepLoganathan / CandidateEvent.cs
Created Dec 30, 2018
Azure Event grid - Domain Event
View CandidateEvent.cs
public class CandidateEvents : ICandidateEvents
string topicEndpoint;
string topicKey ;
string topicHostname ;
TopicCredentials topicCredentials ;
EventGridClient client;
public CandidateEvents()
PradeepLoganathan / ICandidateEvents.cs
Created Dec 30, 2018
Event Grid - Event Interface
View ICandidateEvents.cs
public interface ICandidateEvents
Task CandidateCreatedEvent(Candidate candidate);
Task CandidateUpdatedEvent(Candidate candidate);
PradeepLoganathan / Dockerfile
Created Aug 24, 2018
Simple dockerfile for a console application
View Dockerfile
FROM microsoft/dotnet:2.1-runtime AS base
FROM microsoft/dotnet:2.1-sdk AS build
COPY thetime/thetime.csproj thetime/
RUN dotnet restore thetime/thetime.csproj
COPY . .
WORKDIR /src/thetime
RUN dotnet build thetime.csproj -c Release -o /app
PradeepLoganathan / thetime.cs
Created Aug 24, 2018
A console timer sample
View thetime.cs
using System;
using System.Timers;
namespace thetime
class Program
static void Main(string[] args)
var timer = new Timer(2000);
PradeepLoganathan / AuthGuard.ts
Created May 19, 2018
Code to call the TokenService and store the token
View AuthGuard.ts
(data) => {
console.log(`token is ${data}`);
localStorage.setItem("token", data.token)
localStorage.setItem("tokenexpiration", data.expiration)
error => {
console.log(`Error in obtaining token ${error}`);
PradeepLoganathan / TokenService.ts
Created May 19, 2018
Angular service to get a JWT token from the token endpoint
View TokenService.ts
import { OnInit, Injectable } from "@angular/core";
import { Observable } from "rxjs/Observable";
import {
} from "@angular/common/http";
import { environment } from "../../../../environments/environment";
import { tap, catchError } from "rxjs/operators";
import { ErrorObservable } from "rxjs/observable/ErrorObservable";
View gist:89c11017673792b1281bd201b9e53fbc
providers: [
{provide: HTTP_INTERCEPTORS, useClass: AddTokenInterceptor, multi:true},
You can’t perform that action at this time.