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> | |
<_IsFunctionsSdkBuild Condition="$(_FunctionsTaskFramework) != ''">true</_IsFunctionsSdkBuild> | |
<_FunctionsExtensionsDir>$(TargetDir)</_FunctionsExtensionsDir> | |
<_FunctionsExtensionsDir Condition="$(_IsFunctionsSdkBuild) == 'true'">$(_FunctionsExtensionsDir)bin</_FunctionsExtensionsDir> | |
</PropertyGroup> | |
<Target Name="CopyExtensionsJson" AfterTargets="_GenerateFunctionsAndCopyContentFiles"> | |
<Message Importance="High" Text="Overwritting extensions.json file with one from build." /> |
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 Csv private(headers : string[], data : string [] []) = | |
let headers = ResizeArray<string>(headers) | |
let data = ResizeArray(data |> Array.map (ResizeArray)) | |
static member Empty = Csv([||], [||]) | |
static member Read(file:string) = | |
let csv = CsvFile.Load(file) | |
let headers = |
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 QuotationPrinter = | |
open System | |
open Microsoft.FSharp.Quotations | |
let rec print depth (expr:Expr) = | |
match expr with | |
| Patterns.Value (v, typ) -> sprintf "%A" v | |
| Patterns.Var v -> sprintf "%s:%s" v.Type.Name v.Name | |
| Patterns.NewUnionCase (uci, args) -> |
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 | |
open FSharp.Data.Sql | |
open FSharpComposableQuery | |
FSharp.Data.Sql.Common.QueryEvents.SqlQueryEvent |> Event.add (printfn "Executing SQL: %s") | |
type HR = SqlDataProvider<ConnectionStringName = "***********", DatabaseVendor = Common.DatabaseProviderTypes.ORACLE> | |
let ctx = HR.GetDataContext() | |
type AuditRecord = { |
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
////F# | |
type AddressContext = | |
| CustomerAddressContext of customer:Customer | |
| SiteAddressContext of site:Site | |
| ContactAddressContext of contact:Contact | |
with | |
member x.Id = | |
match x with | |
| CustomerAddressContext _ -> 1 |
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
//I can do the following to cast a given unit but this leads to an individual | |
//lift function for everyType | |
type [<Measure>] type megawatt | |
type [<Measure>] type therm | |
module Megawatt = | |
let inline liftFloat a = (float a) * 1.0<megawatt> | |
let inline liftInt a = (int a) * 1<megawatt> | |
//This gets dull quickly for lots of units of measure |
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 "System.Xml.dll" | |
#r "System.Runtime.Serialization.dll" | |
#r @"D:\Appdev\fsharp.actor\packages\protobuf-net.2.0.0.640\lib\net40\protobuf-net.dll" | |
#load "Library1.fs" | |
open ProtoBuf | |
open System.IO | |
open System.Runtime.Serialization | |
open Protobuf | |
open Microsoft.FSharp.Reflection |
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 | |
open System.Threading | |
open System.Threading.Tasks | |
type CancelToken = | |
| Token of CancellationToken | |
| Default | |
with | |
static member Create(cts:CancellationTokenSource) = | |
Token(cts.Token) |
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 IFoo = | |
abstract Do : unit -> unit | |
type Foo1() = | |
interface IFoo with | |
member x.Do() = () | |
type Foo2() = | |
interface IFoo with | |
member x.Do() = () |
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
let processes = System.Diagnostics.Process.GetProcesses() |> Array.filter (fun p -> p.ProcessName.StartsWith("Raven")) |> Seq.head | |
let ofEnumerator (enum : System.Collections.IEnumerable) : seq<'a> = | |
let en = enum.GetEnumerator() | |
seq { | |
while en.MoveNext() do | |
yield en.Current :?> 'a | |
} | |
let isNet = |
NewerOlder