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
// A lossy Result seq fold | |
let singleResult<'T,'U> (rs : Result<'T,'U> seq) : Result<'T seq,'U> = | |
let folder (ts, us) r = | |
match r with | |
| Ok t -> (Seq.append ts [|t|], us) | |
| Error u -> (ts, Seq.append us [|u|]) | |
rs | |
|> Seq.fold folder (Seq.empty, Seq.empty) |
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
#r "packages/Antlr4.Runtime/lib/net45/Antlr4.Runtime.dll" | |
#r "packages/Liquid.NET/lib/net452/Liquid.NET.dll" | |
#r "packages/YamlDotNet/lib/net45/YamlDotNet.dll" | |
namespace Hyde | |
type FrontMatter = Map<string,obj> | |
type ContentItem = { | |
FrontMatter:FrontMatter | |
ContentText:string | |
} |
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
wget https://github.com/npryce/adr-tools/archive/3.0.0.tar.gz | |
tar -xf 3.0.0.tar.gz | |
export PATH="$PATH:~/adr-tools-3.0.0/src/" | |
source ~/.profile |
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
#r "packages/NETStandard.Library/build/netstandard2.0/ref/netstandard.dll" | |
open canopy.csharp | |
#r "packages/Selenium.WebDriver/lib/netstandard2.0/WebDriver.dll" | |
#r "packages/canopy/lib/netstandard2.0/canopy.dll" | |
open System | |
open canopy.classic | |
open OpenQA.Selenium | |
/////////////////////////////////////// |
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
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
# $tag = (Invoke-WebRequest -Uri https://api.github.com/repos/npryce/adr-tools/releases | ConvertFrom-Json)[0].tag_name | |
# Set explicit version due to https://github.com/npryce/adr-tools/issues/71 | |
$tag = "2.1.0" | |
$uri = " https://github.com/npryce/adr-tools/archive/" + $tag + ".zip" | |
Invoke-WebRequest $uri -OutFile C:\Temp\adr.zip | |
Expand-Archive "C:\Temp\adr.zip" -Force -DestinationPath "C:\Temp\" | |
$src = "C:\Temp\adr-tools-" + $tag + "\src\*" | |
Copy-Item -Force -Recurse -Verbose $src -Destination "C:\Program Files\Git\usr\bin\" |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace X | |
{ | |
public class Result | |
{ | |
public static Result Success() => new Result(); | |
public static Result Fail(params Exception[] exceptions) => new Result(exceptions); |
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
$buildToolsUrl = "https://aka.ms/vs/15/release/vs_buildtools.exe" | |
$installLocation = "C:\TEMP\vs_buildtools.exe" | |
(New-Object System.Net.WebClient).DownloadFile($buildToolsUrl, $installLocation) |
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
namespace Native | |
type HookProc = delegate of int * nativeint * nativeint -> nativeint | |
module User32 = | |
open System.Runtime.InteropServices | |
[<DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)>] | |
extern nativeint SetWindowsHookEx(int idHook, HookProc lpfn, nativeint hMod, uint32 dwThreadId) |
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
#r "packages/PdfSharp/lib/net20/PdfSharp.dll" | |
open PdfSharp.Pdf.IO | |
open System.Text | |
open PdfSharp.Pdf.Content.Objects | |
open PdfSharp.Pdf.Content | |
let rec extractText(content:CObject, sb:StringBuilder) = | |
match content with | |
| :? CArray as xs -> for x in xs do extractText(x, sb) |
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
open System.IO | |
open Microsoft.FSharp.Reflection | |
open System | |
type Array = | |
static member join delimiter xs = | |
xs | |
|> Array.map (fun x -> x.ToString()) | |
|> String.concat delimiter |