This file contains hidden or 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
let o x = x :> obj | |
let getSuperUserData super = | |
writer { | |
let sw = Stopwatch.StartNew() | |
let service = getService () | |
let result = service.getSuperUserDetails super | |
do! write ("serviceElapsed", o sw.ElapsedMilliseconds) | |
match result with |
This file contains hidden or 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 Log = string * int | |
let f: Writer<Log, bool> = | |
writer { | |
let x = 1 | |
do! write ("x", x) | |
let y = 2 | |
do! write ("y", y) | |
let z = x + y | |
do! write ("result", z) |
This file contains hidden or 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 WriterBuilder() = | |
member __.Return(x) = retn x | |
member __.Bind(m, f) = | |
let (a, logs1) = run m | |
let (b, logs2) = run (f a) | |
Writer(fun () -> b, logs1 @ logs2) | |
let writer = WriterBuilder() |
This file contains hidden or 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 Writer<'Log, 'T> = Writer of (Unit -> 'T * 'Log list) | |
let retn (x: 'T) = Writer(fun () -> x, []) | |
let write (log: 'Log) = Writer(fun () -> (), [ log ]) | |
let run (Writer writer) : 'T * 'Log list = writer () |
This file contains hidden or 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
let getSuperUserData (super, log: Logger) = | |
let sw = Stopwatch.StartNew() | |
let service = getService () | |
let result = service.getSuperUserDetails super | |
log.info ({| serviceElapsed = sw.ElapsedMilliseconds |}) | |
match result with | |
| Ok res -> | |
log.info ({| serviceResult = "success" |}) |
This file contains hidden or 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 Async = | |
let retn x = async { | |
return x } | |
let bind f m = async { | |
let! x = m | |
return! f x } | |
This file contains hidden or 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
source https://www.nuget.org/api/v2 | |
nuget Microsoft.AspNetCore | |
nuget Microsoft.AspNetCore.Mvc | |
nuget Microsoft.AspNetCore.StaticFiles | |
nuget Microsoft.NET.Test.Sdk | |
nuget Moq | |
nuget Newtonsoft.Json | |
nuget PetaPoco.NetCore | |
nuget Serilog.AspNetCore |
This file contains hidden or 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
function Get-CurrentRepoName(){ | |
$repoPath = git rev-parse --show-toplevel | |
$repoName = basename $repoPath | |
return $repoName | |
} | |
function ClearReSharperSolutionCache(){ | |
$repoName = Get-CurrentRepoName | |
$rootPath = $env:localappdata + "\JetBrains\ReSharper\v8.2\SolutionCaches\" | |
$folders = get-childitem $rootPath |
This file contains hidden or 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
using System; | |
using System.Configuration; | |
using ServiceStack.Redis; | |
using StructureMap; | |
using StructureMap.Configuration.DSL; | |
namespace Example.IoC | |
{ | |
public class InfrastructureRegistry : Registry | |
{ |
This file contains hidden or 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
function Get-ScriptDirectory | |
{ | |
$Invocation = (Get-Variable MyInvocation -Scope 1).Value | |
Split-Path $Invocation.MyCommand.Path | |
} | |
$targets = $env:TargetDeployUrls -split "," | |
foreach ($t in $targets) | |
{ |
NewerOlder