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.Speech" | |
open System.Speech.Synthesis | |
let player1Voice = new SpeechSynthesizer(); | |
player1Voice.GetInstalledVoices() |> Seq.map(fun v -> v.VoiceInfo.Name,v.VoiceInfo.Age, v.VoiceInfo.Culture.IetfLanguageTag, v.VoiceInfo.Gender) | |
player1Voice.SelectVoice("Microsoft Hortense Desktop") | |
let player2Voice = new SpeechSynthesizer(); | |
player2Voice.SelectVoice("Microsoft Hortense Desktop") |
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.Speech" | |
open System.Speech.Synthesis | |
let player1Voice = new SpeechSynthesizer(); | |
player1Voice.GetInstalledVoices() |> Seq.map(fun v -> v.VoiceInfo.Name,v.VoiceInfo.Age, v.VoiceInfo.Culture.IetfLanguageTag, v.VoiceInfo.Gender) | |
player1Voice.SelectVoice("Microsoft Hortense Desktop") | |
let player2Voice = new SpeechSynthesizer(); | |
player2Voice.SelectVoice("Microsoft Hortense Desktop") |
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
#time | |
#r @"..\packages\Hopac\lib\net45\Hopac.Core.dll" | |
#r @"..\packages\Hopac\lib\net45\Hopac.dll" | |
#r @"..\packages\Hopac\lib\net45\Hopac.Platform.dll" | |
open Hopac | |
open Hopac.Infixes | |
let t label f = | |
let sw = System.Diagnostics.Stopwatch.StartNew () |
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 PATH = | |
open System | |
let private divider = | |
match Environment.OSVersion.Platform with | |
| PlatformID.Unix | |
| PlatformID.MacOSX -> ":" | |
| _ -> ";" | |
let private zmqFolder = __SOURCE_DIRECTORY__ | |
let private oldPATH = ref "" | |
// temporarily add location of native libs to global environment |
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 score = | |
let score x y z = | |
if x = 10 || x + y = 10 then x + y + z | |
else x + y | |
List.fold | |
<| fun s v -> | |
match v, s with | |
| z, (r, [x;y]) -> (r + score x y z), [y;z] | |
| y, (r, x::tail) -> r, x::y::tail |
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 logger = | |
let convertLevel = function | |
| Logging.LogLevel.Debug -> LogLevel.Debug | |
| Logging.LogLevel.Verbose -> LogLevel.Trace | |
| Logging.LogLevel.Info -> LogLevel.Info | |
| Logging.LogLevel.Warn -> LogLevel.Warn | |
| Logging.LogLevel.Error -> LogLevel.Error | |
| Logging.LogLevel.Fatal -> LogLevel.Fatal | |
let name = "WebService" |
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 log = Log.logger "WebService" | |
let logger = | |
let convertLevel = function | |
| Logging.LogLevel.Debug -> LogLevel.Debug | |
| Logging.LogLevel.Verbose -> LogLevel.Trace | |
| Logging.LogLevel.Info -> LogLevel.Info | |
| Logging.LogLevel.Warn -> LogLevel.Warn | |
| Logging.LogLevel.Error -> LogLevel.Error | |
| Logging.LogLevel.Fatal -> LogLevel.Fatal |
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\Suave\lib\net40\Suave.dll" | |
#r @"packages\NLog\lib\net45\NLog.dll" | |
open System | |
open System.IO | |
open Suave | |
open System.Net | |
open Suave.Filters | |
open Suave.Operators | |
open Suave.RequestErrors |
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\FSharp.Data\lib\net40\FSharp.Data.dll""" | |
open FSharp.Data | |
let [<Literal>] sample = """{ | |
"kind": "customsearch#search", | |
"url": { | |
"type": "application/json", | |
"template": "https://www.googleapis.com/customsearch/v1?q={searchTerms}&num={count?}&start={startIndex?}&lr={language?}&safe={safe?}&cx={cx?}&sort={sort?}&filter={filter?}&gl={gl?}&cr={cr?}&googlehost={googleHost?}&c2coff={disableCnTwTranslation?}&hq={hq?}&hl={hl?}&siteSearch={siteSearch?}&siteSearchFilter={siteSearchFilter?}&exactTerms={exactTerms?}&excludeTerms={excludeTerms?}&linkSite={linkSite?}&orTerms={orTerms?}&relatedSite={relatedSite?}&dateRestrict={dateRestrict?}&lowRange={lowRange?}&highRange={highRange?}&searchType={searchType}&fileType={fileType?}&rights={rights?}&imgSize={imgSize?}&imgType={imgType?}&imgColorType={imgColorType?}&imgDominantColor={imgDominantColor?}&alt=json" | |
}, |
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
//The aim of this gist is to answer to a code review during the fsharp mentor program. | |
//The given code uses result in a way where Ok and Error and into the same type causing a lots of match | |
//This version supply a begin of workflow by separating Ok case from Error case and supplying an adapter function called adapt in order to | |
// map legacy domain to the new domain. | |
//Consider the existing code base represented as an union case : | |
type [<Struct>] TransportId = TransportId of string | |
type Transport = |
OlderNewer