Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Remote;
type Order = { Id: Guid; Amount: int }
type Client = { Id: Guid; OpenOrders: int; Balance: int }
type CreateOrderAggregate = { Client: Client; Order: Order }
module CreateOrderAggregate =
let execute (agg: CreateOrderAggregate) =
if agg.Client.Balance >= agg.Order.Amount && agg.Client.OpenOrders < 5 then Ok agg
open System
let inline (|HasMap|) f x = (^x : (static member Map : ('a -> 'b) * ^x -> ^z) f, x) // define type class
let inline map f (HasMap f x) = x // call type class instance
let inline (|HasPure|) x = (^x : (static member Pure : 'a -> ^x)x)
let inline pure' (HasPure x) = x
let inline (|HasBind|) f x = (^x : (static member Bind : ('a -> ^z) * ^x -> ^z)f, x)
let inline bind f (HasBind f x) = x
module TypeClasses
open System
let inline (|HasId|) x = (^a : (member Id : 'Id)x) // define type class
let inline getId (HasId x) = x // call type class instance
let inline (|HasShow|) x = (^a : (static member Show : ^a -> string)x) // define type class
let inline show (HasShow x) = x // call type class instance
let inline (|HasMap|) f x = (^x : (static member Map : ('a -> 'b) * ^x -> ^z) f, x) // define type class
public class PoolItem<T> : IDisposable
{
private readonly Action<PoolItem<T>> _onRelease;
public T Value { get; }
public PoolItem(T value, Action<PoolItem<T>> onRelease)
{
_onRelease = onRelease;
Value = value;
}
public static class SonyReger
{
public static async Task Register(LinkedAccountsModel InputLinkedAccountsModel, ProxyModel proxy)
{
await Task.Delay(1);
using (var wb = DriverBuilder.MakeDriverForSony())
{
wb.ClickEx(By.CssSelector("asdasd"));
module Application.ES
open System
open FsToolkit.ErrorHandling
let inline ( ^ ) f x = f x
type CommandMeta<'id, 'command> = { AggId: 'id; Command: 'command }
type EventMeta<'id, 'payload> = { AggId: 'id; Created: DateTime; Payload: 'payload }
let mkEvent id created x = { AggId = id; Created = created; Payload = x }
open System
open System.Collections.Concurrent
open System.Threading.Tasks
let inline ( ^ ) f x = f x
let inline safeable f x =
try
Ok (f x)
with e -> Error e
module Application.ES
open System
open System.Collections.Concurrent
let inline ( ^ ) f x = f x
type UserStatus = Normal | VIP | SuperVIP
type Name = Name of string
type ColumnSelector = { Name: string; ColumnName: string }
type RowSelector = { Name: string; RowName: string }
type SetValueArgs = { Name: string; RowName: string; ColumnName: string; Value: string }
type SetDefaultValueArgs = { Name: string; RowName: string; Value: string }
type Command =
| Create of string
| AddColumn of ColumnSelector