This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Entity = { ArrivalDate: DateTime } | |
type IDb = | |
abstract member Conn: string | |
type Workflow<'Result> = Workflow of (IDb -> 'Result) | |
let db = { new IDb with member x.Conn = "asd" } | |
let run idb (Workflow fn) = fn idb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<OutputType>Exe</OutputType> | |
<TargetFramework>netcoreapp3.1</TargetFramework> | |
</PropertyGroup> | |
<ItemGroup> | |
<Compile Include="Program.fs" /> | |
</ItemGroup> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Redux = | |
type Reducer<'S, 'A> = 'S option -> 'A -> 'S | |
type IRootReducer = interface end | |
type IStore = interface end | |
type IDispatch<'A> = 'A -> unit | |
let combineReducers (reducers: {| listReducer: Reducer<'S, 'A> |}): IRootReducer = importMember "redux" | |
let createStore (rootReducer: IRootReducer): IStore = importMember "redux" | |
let useSelector (selector: 'S -> 'TS) : 'TS = importMember "react-redux" | |
let useDispatch<'A> () : IDispatch<'A> = importMember "react-redux" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project> | |
<PropertyGroup> | |
<CodeAnalysisRuleSet>..\MyRuleset.ruleset</CodeAnalysisRuleSet> | |
</PropertyGroup> | |
<ItemGroup> | |
<AdditionalFiles Include="..\stylecop.json" Link="stylecop.json" /> | |
</ItemGroup> | |
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ng-template cdkPortal> | |
<div class="popup"> | |
<div class="arrow"></div> | |
<ng-content></ng-content> | |
</div> | |
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Nominal types (branding) | |
module BrandedTypes { | |
const BRAND = Symbol(); | |
type Branded<T, TBrand> = T & { readonly [BRAND]: TBrand }; | |
export type UserId = Branded<number, 'userId'>; | |
export type RoleId = Branded<number, 'roleId'>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UserStorage { | |
private readonly reload$ = new Subject<void>(); | |
private readonly userId$ = new ReplaySubject<number>(1); | |
public readonly user: Observable<string>; | |
constructor() { | |
this.user = combineLatest([ | |
this.reload$.pipe(startWith(undefined)), | |
this.userId$ | |
]).pipe( | |
switchMap(([_, userId]) => this.loadUser(userId)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git stash show -p -u stash@{0} > Stash0.patch | |
git apply Stash0.patch |
OlderNewer