Skip to content

Instantly share code, notes, and snippets.

Avatar

Isaac Abraham isaacabraham

View GitHub Profile
View mbracescript.fsx
#r "nuget:MBrace.Thespian"
open MBrace
open MBrace.Thespian
MBrace.Thespian.ThespianWorker.LocalExecutable <- "C:/Users/Isaac/.nuget/packages/mbrace.thespian/1.5.4/tools/mbrace.thespian.worker.exe"
let cluster = ThespianCluster.InitOnCurrentMachine(workerCount = 4)
(*
View overloads-with-flexible-types.fsx
// Couple of interfaces
type IFoo = interface end
type IBar = interface end
// Some records that implement the interfaces
type FooImpl1 = { Name : string } interface IFoo
type FooImpl2 = { OtherName : string } interface IFoo
type BarImpl1 = { Age : int } interface IBar
View code.fs
open BenchmarkDotNet.Attributes
open BenchmarkDotNet.Running
open BenchmarkDotNet.Jobs
[<SimpleJob(RuntimeMoniker.CoreRt31); SimpleJob(RuntimeMoniker.CoreRt50)>]
type Benchmarks() =
[<Benchmark; Arguments 1000; Arguments 10000; Arguments 100000; Arguments 1000000>]
member _.MapCreate size =
let hs = [| for i in 1 .. size -> i, i |] |> Map
[| for i in 1 .. size -> hs.[i] |]
View bad.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {},
"resources": [
{
"apiVersion": "2019-06-01",
"dependsOn": [],
"kind": "StorageV2",
View simple.cs
using System;
using System.Threading.Tasks;
namespace ConsoleApp8
{
class Program
{
static async Task<int> DoStuff()
{
var x = await System.IO.File.ReadAllTextAsync("Foo");
View spectredata.fs
module IsaacStuff =
type TableRow =
| Empty
| DataRow of string array
type TableSetting =
| Border of TableBorder
| Column of TableColumn
| Row of TableRow
let createTable settings =
settings
View YieldOptions.fs
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 -> ()
]
View FarmerFunctions.fsx
#r "nuget:Farmer"
open Farmer
open Farmer.Builders
let myFunctions = functions {
name "myFunctions"
}
let template = arm {
View 1-nav.html
<aside class="relative bg-blue-700 lg:self-stretch lg:w-64 w-full shadow-xl flex flex-col">
<div class="p-6 flex justify-between">
<a href="..">
<img class="object-scale-down h-8 lg:h-32" src=".." alt=".. Logo"/>
</a>
<div class="block lg:hidden">
<button id="nav-toggle" class="flex items-center px-3 py-2 border rounded text-white border-white">
<svg class="fill-current h-3 w-3" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
<title>Menu</title>
<path d="M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"/>
View datestream.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace ICantSeeSharp
{
static class DateStream
{
public static IEnumerable<DateTime> AllDates
{
You can’t perform that action at this time.