Skip to content

Instantly share code, notes, and snippets.

@kudchikarsk
kudchikarsk / SelfSignedCert.md
Created December 17, 2023 08:08 — forked from mrcunninghamz/SelfSignedCert.md
Creating a self signed certificate in a pfx format on a mac.

Create Self Signed Certificate using OpenSSL on a Mac

Introduction

Every now and then I need to create a self signed certificate in azure for something. In my particular case its Azure B2C. I am using a mac so its not simply just running something like

New-SelfSignedCertificate `
    -KeyExportPolicy Exportable `
    -Subject "CN=yourappname.yourtenant.onmicrosoft.com" `
 -KeyAlgorithm RSA `
@kudchikarsk
kudchikarsk / CrowdFunding.sol
Created February 24, 2022 16:30
CrowdFunding Dapp
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract CrowdFunding {
uint public minContribution;
uint public deadline;
uint public target;
uint public raiseAmount;
@kudchikarsk
kudchikarsk / IEnumerableExtension.cs
Created January 26, 2022 07:01
IEnumerableExtension.cs
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace Aasani.CRM.Logic
{
public static class IEnumerableExtension
{
public static IEnumerable<T> OrderByName<T>(this IEnumerable<T> @this, string propName)
{
using Microsoft.AspNetCore.Builder;
namespace Enqueme.API.Middleware
{
public static class HttpContextMiddlewareExtensions
{
public static IApplicationBuilder UseHttpContextMiddleware(this IApplicationBuilder builder)
{
return builder.UseMiddleware<HttpContextMiddleware>();
}
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using Serilog;
using Serilog.Context;
using System;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
@kudchikarsk
kudchikarsk / authentication.service.ts
Created May 21, 2021 05:33
authentication.service.ts
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable, of } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { map, switchMap, throwIfEmpty, tap, catchError } from 'rxjs/operators';
import { environment } from 'src/environments/environment';
import { UserService } from './user.service';
@Injectable({
providedIn: 'root'
})
@kudchikarsk
kudchikarsk / jwt.interceptor.ts
Created May 21, 2021 05:32
jwt.interceptor.ts
import { Injectable } from '@angular/core';
import { HttpRequest, HttpHandler, HttpEvent, HttpInterceptor } from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { AuthenticationService } from '../services/authentication.service';
import { catchError } from 'rxjs/operators';
import { Router } from '@angular/router';
@Injectable()
export class JwtInterceptor implements HttpInterceptor {
constructor(private authenticationService: AuthenticationService,
@kudchikarsk
kudchikarsk / JS-LINQ.js
Created December 23, 2020 16:15 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@kudchikarsk
kudchikarsk / IQueryableExtensions.cs
Last active July 21, 2020 13:54
A extension class for asp.net web api developers. Extension methods for pagination, orderby properties, alpha pagination, and date range filter
using Core.Utils;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
@kudchikarsk
kudchikarsk / forminput.js
Last active April 23, 2019 17:59
Form input directive for Angularjs
(function (module) {
var watcherFor = function (form, name) {
return function () {
if (name && form[name]) {
return form[name].$invalid;
}
};
};