Skip to content

Instantly share code, notes, and snippets.

@mavnn
mavnn / Embedded.fs
Created February 28, 2014 09:53
Serve embedded resources via Suave
module Embedded
open System
open System.IO
open System.Reflection
open Suave
open Suave.Http
open Suave.Types
open Suave.Socket
@mavnn
mavnn / gist:9349291
Last active August 29, 2015 13:57
Preview
In this session we'll start from a brand new Visual Studio
project and work as a group to a type provider which:
* Creates a namespace
* Adds a type to that namespace with:
* a static property
* a constructor or 2
* an instance property
* an instance method
module PDF
// You can install Pechkin from NuGet
open Pechkin
open System.Drawing.Printing
[<Measure>]
type mm
[<Measure>]
@mavnn
mavnn / Tests.fs
Last active August 29, 2015 14:07
Boolean Algebra
module Algebra.Boolean.Tests
open Microsoft.FSharp.Quotations
open Algebra.Boolean
open Xunit
[<Fact>]
let ``not pattern`` () =
Assert.Equal (<@@ true @@>, match <@@ not true @@> with Not' e -> e)
@mavnn
mavnn / keybase.md
Created September 30, 2014 11:19
keybase.md

Keybase proof

I hereby claim:

  • I am mavnn on github.
  • I am mavnn (https://keybase.io/mavnn) on keybase.
  • I have a public key whose fingerprint is 075C 7646 3066 8A63 B3BD 05DC 5F95 FCB1 A054 42B1

To claim this, I am signing this object:

@mavnn
mavnn / paket.dependencies
Last active August 29, 2015 14:08
stealing
source https://nuget.org/api/v2
nuget FSharp.Formatting
nuget NUnit
nuget NUnit.Runners
nuget Nuget.CommandLine
nuget FAKE
nuget SourceLink.Fake
github fsharp/FAKE modules/Octokit/Octokit.fsx
@mavnn
mavnn / Program.fs
Created November 17, 2014 12:25
Strongly typed command line arguments
open Targ
type InputArgs = Args<"""
v|Verbose|Flag to specify if in verbose mode|Bool|
s|TargetSchema|Set schema (http/https/...)|String|http
u|TargetUrl|Set Url to download from|String|google.com
p|Port|Set port to connect on|Int|80
""">
[<EntryPoint>]
@mavnn
mavnn / Game.fsx
Created November 21, 2014 12:06
Conway's Game of Life (1 hour, 74 lines...)
open System
let (|Alive|Dead|) i =
match i with
| 0 -> Dead
| 1 -> Alive
| _ -> failwith "What?"
let rand = Random()
@mavnn
mavnn / Provider.fsx
Last active August 29, 2015 14:11
Trying member ordering...
module Provider
#if INTERACTIVE
#load "paket-files/fsprojects/FSharp.TypeProviders.StarterPack/src/ProvidedTypes.fsi"
#load "paket-files/fsprojects/FSharp.TypeProviders.StarterPack/src/ProvidedTypes.fs"
#endif
open System.Reflection
open ProviderImplementation.ProvidedTypes
open Microsoft.FSharp.Core.CompilerServices
open Microsoft.FSharp.Quotations
@mavnn
mavnn / Validate.fsx
Created June 24, 2015 10:03
Sometimes it's nice to be able to both experiment in FSI - and also build an executable for others to use.
#if INTERACTIVE
#r "System.Xml"
#endif
open System.Xml
open System.Xml.Schema
let readAndValidate (schema : string) (file : string) =
let schemaSet = XmlSchemaSet()
schemaSet.Add("http://15below.com/PASNGR", schema)