Skip to content

Instantly share code, notes, and snippets.

View goswinr's full-sized avatar

Goswin Rothenthal goswinr

View GitHub Profile
@mathias-brandewinder
mathias-brandewinder / App.fs
Last active July 11, 2020 13:56
Lorentz attractor in Fable-Elmish
(*
Simulation of the Lorentz attractor, using Fable.
If you want to see this code in action, just copy this code into the Fable REPL:
https://fable.io/repl/
*)
module App
open Elmish
open Elmish.React
// ts2fable 0.0.0
namespace rec Fable.Three
open System
open Fable.Core
open Fable.Import.JS
open Fable.Import.Browser
module Three =
@mrange
mrange / on-tail-recursion.md
Last active March 15, 2022 04:57
On the topic of tail calls in .NET

On the topic of tail calls in .NET

Let's say you have implemented a small data pipeline library to replace LINQ.

module TrivialStream =
  type Receiver<'T> = 'T            -> unit
  type Stream<'T>   = Receiver<'T>  -> unit

  module Details =
@realvictorprm
realvictorprm / PaketDependencyManagementMadeEasy.fsx
Last active June 12, 2018 19:41
A must have for your script file to ease spreading a small proof of concept with dependencies!
open System
open System.IO
open System.Diagnostics
let downloadDependencies deps =
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__
if not (File.Exists "paket.exe") then
async {
let url = "http://fsprojects.github.io/Paket/stable"
@jesterKing
jesterKing / GhFsharpTest.fs
Last active June 12, 2019 07:09
F# sample component for testing on Mac Rhino Grasshopper (v6, aka WIP)
namespace GhFsharpTest
open Grasshopper.Kernel
open Grasshopper.Kernel.Types
type Priority() =
inherit GH_AssemblyPriority()
override u.PriorityLoad() =
GH_LoadingInstruction.Proceed
@alfonsogarciacaro
alfonsogarciacaro / Deploy.md
Last active March 3, 2023 09:50
Deploying an F# ASP.NET Core app (Giraffe) to Azure

Deploying an F# ASP.NET Core app to Azure

Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)

Preparation

The following steps are mostly taken from this guide and it's only necessary to do them once:

  1. Create an account in Azure (or use an existing one)
  2. Create a resource group (or use an existing one)
@imAliAsad
imAliAsad / ExtractFamilyParameterData.cs
Created January 21, 2018 08:01
Extract or read Revit family parameter data and convert its internal ( Imperial ) unit into the metrics unit
/// <summary>
/// Extract all family type properties data
/// </summary>
/// <param name="app"></param>
private MultiValueDictionary<string, Tuple<string, string>> ExtractFamilyParameterInfo(Application app)
{
//Open Revit Family File in a separate document
var doc = app.OpenDocumentFile(FamilyPath);
#I __SOURCE_DIRECTORY__
#r "libs/NuGet.Core.dll"
#r "System.Xml.Linq"
open NuGet
open System
open System.IO
module NuGet =
@teocomi
teocomi / Win32Api.cs
Last active April 24, 2023 07:09
Run Revit commands using Win32 API
/// <summary>
/// Run Revit commands using Win32 API
/// </summary>
public class Win32Api
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
static extern bool SetFocus(IntPtr hWnd);
@sgoguen
sgoguen / merkle-tree.fsx
Created February 16, 2017 21:30
Merkle Trees
open System.IO
open System.Collections.Concurrent
// A Merkle tree for a file system might look like this
// PASTE!!
let isDirectory(path:string) =
let attr = File.GetAttributes(path)
attr.HasFlag(FileAttributes.Directory)