Skip to content

Instantly share code, notes, and snippets.

View akhansari's full-sized avatar
🦎

Amin Khansari akhansari

🦎
View GitHub Profile
@akhansari
akhansari / Program1-Minimal.fs
Last active September 9, 2023 13:33
F# : Different ways to create an API without a dependency
open System
open Microsoft.AspNetCore.Builder
open Microsoft.AspNetCore.Http
open Microsoft.AspNetCore.Routing
type Item = { Id: int32; Name: string; Price: decimal }
let rnd = Random()
let getProducts () =
[ for _ in 1..3 do { Id = rnd.Next 100; Name = "Blueberry"; Price = 10m } ]

The OAuth Bible

I tried to make this as understandable as possible for any party reading it which means that the wording, references, and terminology used may not reflect that of a technical paper or resource. Excuse me if you may for I wish all to understand this, and not just those with a degree in understanding legal or technical jargon.

Created with love by Nijikokun @ Mashape, the team behing the OSS API management layer Kong, and Mashape Analytics for visualizing and monitoring API traffic.


Hey! Interested in simplifying the process to consume OAuth services like twitter, facebook, github, and thousands more? Check out Guardian, it was built with simplicity, security, and ease of use in mind, allowing you to consume OAuth in a single request.

@akhansari
akhansari / 01 setup terminal.ps1
Last active October 30, 2023 15:30
My PowerShell Setup on Windows (Which is more or less the same on Linux)
# open PowerShell legacy
# install https://scoop.sh
irm get.scoop.sh | iex
# add extras bucket
scoop bucket add extras
# install the new PowerShell
scoop install pwsh
@akhansari
akhansari / EsBankAccount.cs
Last active March 9, 2024 08:53
C# prototype of the Decider pattern. (F# version: https://github.com/akhansari/EsBankAccount)
namespace EsBankAccount.Account;
using Events = IReadOnlyCollection<IEvent>;
public record Transaction(decimal Amount, DateTime Date);
// events
public interface IEvent { } // used to mimic a discriminated union
public record Deposited(Transaction Transaction) : IEvent;
public record Withdrawn(Transaction Transaction) : IEvent;
@akhansari
akhansari / EsBankAccount.ts
Last active April 8, 2024 12:40
TypeScript prototype of the Decider pattern. (F# version: https://github.com/akhansari/EsBankAccount)
import * as assert from "assert";
/** Decider Pattern **/
type Transaction = {
amount: number
date: Date
}
type Deposited = Transaction & {