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 Game | |
open System | |
open System.Diagnostics | |
module Cards = | |
type Suit = Clubs | Diamonds | Hearts | Spades | |
with | |
override x.ToString() = | |
match x with |
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
[StructLayout(LayoutKind.Explicit)] | |
public struct ByteConverter<T> where T : struct | |
{ | |
#region Private Members | |
private static int SIZE_OF = Marshal.SizeOf(typeof(T)); | |
[FieldOffset(0)] | |
private byte[] _bytes; |
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 RockSpot.Runtime.Validation | |
open Microsoft.FSharp.Quotations | |
open System | |
open System.Text | |
open FSharpx.Regex.Compiled | |
open FSharpx.Linq.QuotationEvaluation | |
type Test = |
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 Tests = | |
type User = { Name : string; Age : int } | |
//let user = { Name = "Diego"; Age = 26 } | |
let validate ux = validation ux { | |
required <@ ux.Name @> | |
minLength <@ ux.Name @> 3 | |
adhoc (if ux.Name = "Diego" then Success else Failure "hahaha") |
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 RockSpot.Runtime | |
open System | |
open ServiceStack.Text | |
module ServiceStack = | |
let inline deserializeOption x = | |
match x with | |
| null -> None |
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 FSharp.Windows | |
open System.ComponentModel | |
[<AbstractClass>] | |
type Model() = | |
let propertyChangedEvent = Event<_,_>() | |
interface INotifyPropertyChanged with |
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 System.Numerics | |
[<AutoOpen>] | |
module DivRem = | |
type DivRem = DivRem with | |
static member (/%) (x : int32, DivRem) = fun y -> System.Math.DivRem(x, y) | |
static member (/%) (x : int64, DivRem) = fun y -> System.Math.DivRem(x, y) | |
static member (/%) (x : bigint, DivRem) = fun y -> BigInteger.DivRem(x, y) | |
let inline (/%) x y = (x /% DivRem) y |
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
// Author: Tomas Petricek (www.tomasp.net), Diego Frata | |
open System.Linq | |
// Extend the standard QueryBuilder type with an additional | |
// custom operation (that must be expressed in terms of other | |
// query operations) and marked with ReflectedDefinition | |
type Linq.QueryBuilder with | |
[<ReflectedDefinition; CustomOperation("exactlyOneOrNone")>] | |
member __.ExactlyOneOrNone (source : Linq.QuerySource<'T, 'U>) : 'T option = | |
query.ExactlyOneOrDefault(query.Select(source, fun x -> Some x)) |
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.Collections | |
open System.Configuration | |
open System.Data.Entity.Design.PluralizationServices | |
open System.Linq | |
open FluentMongo.Linq | |
open MongoDB.Bson | |
open MongoDB.Driver | |
open MongoDB.Driver.Builders |