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.Linq" | |
open System | |
open System.IO | |
open System.Xml.Linq | |
let script = seq { | |
//TODO: this currently loads fsproj's in alphabeticall order, we should instead | |
//build the dependencies graph of the fsproj's and load them in topological sort order |
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
// Creating new threads | |
open System | |
open System.Threading | |
//What will execute on each thread | |
let threadBody() = | |
for i in 1..5 do | |
//Wait 1/10 of a second | |
Thread.Sleep(100) | |
printfn "[Thread %d] %d ..." |
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 Microsoft.FSharp.Quotations | |
open Microsoft.FSharp.Quotations.Patterns | |
open System.Reflection | |
let hashList f seed = List.fold (fun h v -> h * 37 + f v) seed | |
let (<+) x y = x * 37 + y | |
let (!<) f x y = x <+ f y | |
let rec hashC funcs = |
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 Tsunami.Server | |
open System | |
open System.IO | |
open System.Linq | |
open System.Net | |
open System.Net.Sockets | |
open System.Text | |
open System.Threading | |
open System.Runtime.Serialization |
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
// Original code: https://gist.github.com/taumuon/11302896 | |
// This implementation optimized by Jack Pappas (https://github.com/jack-pappas) | |
open MathNet.Numerics.Distributions | |
open MathNet.Numerics.Statistics | |
open MathNet.Numerics.Random | |
open LanguagePrimitives | |
let inline callPayoff strike price = | |
max (price - strike) GenericZero |
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
[<AutoOpen>] | |
module Microsoft.FSharp.Reflection.FSharpReflectionExtensions | |
/// Creates an instance of a record type. | |
val MakeRecord : recordType:Type * values:obj [] * ?allowAccessToPrivateRepresentation:bool -> obj | |
/// Reads all the fields from a record value. | |
val GetRecordFields : record:obj * ?allowAccessToPrivateRepresentation:bool -> obj [] | |
/// Precompute a function for reading all the fields from a record. The fields are returned in the |
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
//========================================== | |
// Working fully self-contained getting-started example for Suave Web Server scripting | |
// | |
// Note you don't need to have _anything_ installed before starting with this script. Nothing | |
// but F# Interactive and this script. | |
// | |
// This script fetches the Paket.exe component which is referenced later in the script. | |
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been | |
// downloaded by the user (by executing the first part of the script) the reference | |
// shows as resolved and can be used. |
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/Paket.Core/lib/net45/Paket.Core.dll" | |
open Paket | |
open Paket.Xml | |
open System.Xml | |
let setProjectAttribute attribute innerText (propertyGroup:Xml.XmlNode) = | |
let nodes = propertyGroup.ChildNodes |> Seq.cast<XmlNode> |> Seq.filter(fun node -> node.Name = attribute ) | |
nodes |> Seq.iter(propertyGroup.RemoveChild >> ignore) | |
let attribute = propertyGroup.OwnerDocument.CreateElement(attribute, Constants.ProjectDefaultNameSpace) |
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
Function Create-NuPkgSha512File { | |
[CmdletBinding()] | |
Param( | |
[Parameter(Mandatory=$true,Position=1)] | |
[string]$Path, | |
[Parameter()] | |
[string]$Sha512Path="$Path.sha512" | |
) | |
$sha512 = [Security.Cryptography.SHA512]::Create() |
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
//invaluable for all those Choice<'a, exn> flows | |
let exnf f = Printf.ksprintf (fun s -> exn s) f | |
//combine paths | |
let (</>) x y = System.IO.Path.Combine(x, y) | |
//allows you to pattern match on values in the current scope rather than just literals | |
let (|Eq|_|) expected value = | |
if expected = value then Some () | |
else None |
OlderNewer