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 meleeAttacks | |
(abilities:Abilities) | |
(proficiency:Weapon.Proficiency) | |
(level:int) | |
(weapon:Weapon) = | |
let ability = | |
match weapon.Finesse with | |
| true -> [ STR; DEX ] |
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
struct Z { | |
enum { ToInt = 0 }; | |
}; | |
template<typename T> | |
struct S { | |
enum { ToInt = sizeof(T) }; | |
T t; | |
char c; |
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
// val whenSome: ('b -> 'c) -> 'b option list -> 'c list | |
let whenSome f = List.collect ( Option.map ( f >> List.singleton ) >> Option.defaultValue [] ) |
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
#r obj\Debug\netcoreapp2.2\Server.dll | |
#r ..\.nuget\packages\fable.core\3.0.0\lib\netstandard2.0\Fable.Core.dll | |
#r ..\.nuget\packages\fsharp.core\4.6.2\lib\netstandard1.6\FSharp.Core.dll | |
#r ..\packages\Newtonsoft.Json\lib\netstandard2.0\Newtonsoft.Json.dll | |
#r ..\packages\System.Reflection.TypeExtensions\lib\netstandard2.0\System.Reflection.TypeExtensions.dll | |
#r System.Numerics.dll | |
let dump o = o.Dump() |> ignore | |
let dumpS (s: String) o = o.Dump(s) |> ignore |
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
//fsharp | |
type Result<'Ok, 'Error> = | |
| Ok of 'Ok | |
| Error of 'Error | |
//yolo | |
module Result = | |
let bind f v = |
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
/// Stacks the Async Result monad. | |
module AsyncResult = | |
let ok v = v |> Ok |> Async.result | |
let error v = v |> Error |> Async.result | |
let map f = | |
f |> Result.map |> Async.map |
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
/// <summary> | |
/// Microsoft provided class. It allows dynamic string based querying. | |
/// Very handy when, at compile time, you don't know the type of queries that will be generated. | |
/// </summary> | |
public static class DynamicQueryable | |
{ | |
#region IQueryable Extensions |
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 patchRequest (r: RequestEventArgs) = | |
let filter (s: string) = s.Replace ( "\"", "" ) | |
let doc = using (new MemoryStream ()) <| fun ms -> | |
let xw = System.Xml.XmlWriter.Create ms | |
r.RequestInformation.WriteXml xw | |
xw.Flush () | |
ms.Position <- 0L |
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
# ls -Recurse -Include *.d.ts | % { " declare module $((($_.Name) -split "[.]")[0]) { " ;gc $_; "}" } | Set-ClipBoard | |
node .\ts2fable\build\ts2fable.js material-ui-pickers\lib\build\index.d.ts src\material_ui_pickers.fs -e material-ui-pickers react react-dom material-ui |
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
$strings = @( "file1.bin", "file2.bin", "file3.bin" ) | |
# Compile the code | |
function escape() { process { "@`"$_`"" } } | |
$source = @" | |
using System.Resources; | |
public class MakeResource | |
{ | |
public static void Main(string[] args) |