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
| module IsaacStuff = | |
| type TableRow = | |
| | Empty | |
| | DataRow of string array | |
| type TableSetting = | |
| | Border of TableBorder | |
| | Column of TableColumn | |
| | Row of TableRow | |
| let createTable settings = | |
| settings |
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 maybeAValue = Some "Test" | |
| let firstVersion = [ | |
| "Hello" | |
| "There" | |
| match maybeAValue with // <- explicit match on option and yield only on Some x | |
| | Some v -> v | |
| | None -> () | |
| ] |
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 "nuget:Farmer" | |
| open Farmer | |
| open Farmer.Builders | |
| let myFunctions = functions { | |
| name "myFunctions" | |
| } | |
| let template = arm { |
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
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| namespace ICantSeeSharp | |
| { | |
| static class DateStream | |
| { | |
| public static IEnumerable<DateTime> AllDates | |
| { |
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
| open BenchmarkDotNet | |
| open BenchmarkDotNet.Attributes | |
| open BenchmarkDotNet.Running | |
| let numbers = [ 1 .. 100000 ] | |
| let numbersArray = numbers |> Array.ofList | |
| type Accumulators() = | |
| [<Benchmark>] | |
| member _.ListFold () = List.fold (+) 0 numbers | |
| [<Benchmark>] |
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
| // Boilerplate / "Frameworky" code | |
| module Safe = | |
| /// A function which, when given a model, will return a new model and a command, depending on the state of the server call. | |
| type CallHandler<'TModel, 'TMsg> = 'TModel -> 'TModel * Cmd<'TMsg> | |
| /// Represents a message which encapsulates a client / server call and response. | |
| type ServerMessage<'TModel, 'TMsg> = CallHandler<'TModel, 'TMsg> -> 'TMsg | |
| /// Makes a GET to a server endpoint and handles the outgoing request and incoming response. | |
| let inline Get<'TModel, 'TMsg> endpoint onDispatch onSuccess (serverCall:ServerMessage<'TModel,'TMsg>) input = | |
| let onLoaded entity model = onSuccess model entity, Cmd.none | |
| let loadCommand = Cmd.OfPromise.perform (endpoint >> Fetch.get<unit, _>) input (onLoaded >> serverCall) |
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
| module rec Program | |
| open Microsoft.EntityFrameworkCore | |
| type BloggingContext = | |
| { Blogs : DbSet<Blog> | |
| Posts : DbSet<Post> } | |
| let configureDb (optionsBuilder:DbContextOptionsBuilder) = | |
| optionsBuilder.UseSqlServer @"Server=(localdb)\mssqllocaldb;Database=Blogging;Integrated Security=True" |
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
| open Giraffe | |
| open Saturn | |
| let myRouter = choose [ | |
| route "/api/public" >=> text "Hello" | |
| requiresAuthentication (RequestErrors.UNAUTHORIZED "" "" "admin check") >=> route "/api/admin" >=> text "ADMIN" | |
| requiresAuthentication (RequestErrors.UNAUTHORIZED "" "" "customer check") >=> route "/api/customer" >=> text "CUSTOMER" | |
| ] | |
| let a = application { |
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
| { | |
| "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "outputs": {}, | |
| "parameters": {}, | |
| "resources": [ | |
| { | |
| "apiVersion": "2020-03-01", | |
| "dependsOn": [ | |
| "isaacsupercosmosdb" |