Skip to content

Instantly share code, notes, and snippets.

View goswinr's full-sized avatar

Goswin Rothenthal goswinr

View GitHub Profile
@goswinr
goswinr / if else indentation
Created April 30, 2014 13:14
if else indentation
let x = false
// The indentation of the else clause seems wrong.
// could there be a compiler warning for this ?
if x then
printfn "if ?"
else // bad indentiation
printfn "else ?"
@goswinr
goswinr / Ribbon F#
Last active August 29, 2015 14:08
Update for Ribbon menu with ExcelDna and F#
// typos fixed in:
// http://bramjochems.com/blog/2014/05/creating-ribbon-menu-exceldna-f/
module RibbonBuilder =
// http://bramjochems.com/blog/2014/05/creating-ribbon-menu-exceldna-f/
type RibbonButtonSize =
| Large
| Medium
// Based on the SDK Sampl GeometryCreation_BooleanOperations
// This is testing code. Many improvements can be made before use in real work
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitDBAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPIUI.dll"
#r @"C:\Program Files\Mantis\Tsunami.IDEDesktop.dll"
open Autodesk.Revit
open Autodesk.Revit.UI
  1. Download the Mantis zip file from https://dl.dropboxusercontent.com/u/157820459/Mantis.zip
  2. Unblock the Mantis zip file before extraction http://blogs.msdn.com/b/delay/p/unblockingdownloadedfile.aspx
  3. Place the extracted folder Mantis in the program files directory "C:\Program Files" - note that Mantis only works for 64 bit Windows at this stage
  4. Copy the Mantis.addin file from "C:\Program Files\Mantis\Mantis.addin" to "C:\ProgramData\Autodesk\Revit\Addins\2016\Mantis.addin"
  5. Run Revit, open file, and start Mantis from the Add-Ins Ribbon
  6. To test copy the F# code from https://gist.github.com/moloneymb/4561a548a3378bc2775f into the shell. Select all text and run selected (Run button or Alt+Enter). Once the code has run a new shape should appear in 3D Views -> CSGTree
  7. For help or more advanced functionality please feel free to reach out to me at moloneymb (twitter, gmail or skype)
@goswinr
goswinr / RhinoScriptSyntax.fs
Last active February 28, 2017 14:49
A suggestion on how Rhinoscriptsyntax could be ported to F#
open Microsoft.FSharp.Collections
open FsEx // some F# helper libraries. eg.type Rarr = ResizeArray
open System
open Rhino
open Rhino.Geometry
open System.Drawing
module GeoExchange =
// translation from custom 3D classes
@goswinr
goswinr / 01_LAD in Revit.fsx
Last active April 12, 2017 13:44
Generating the model of Louvre Abu Dhabi in Revit with Mantis in F#
// Generating the full model using my custom DLLs for geometry input
// F# editor: https://gist.github.com/moloneymb/5e5608c129337cfefa40
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitDBAPI.dll"
#r @"C:\Program Files\Autodesk\Revit 2016\RevitAPIUI.dll"
#r @"C:\Program Files\Mantis\Tsunami.IDEDesktop.dll"
#r @"C:\work\goswin\30_F#\16-135_LAD\LAD\GosLib\bin\Release\GosLib.dll"
#r @"C:\work\goswin\30_F#\16-135_LAD\LAD\LAD\bin\Release\LAD.dll"
open Autodesk.Revit.DB
#I __SOURCE_DIRECTORY__
#r "libs/NuGet.Core.dll"
#r "System.Xml.Linq"
open NuGet
open System
open System.IO
module NuGet =
@goswinr
goswinr / gist:76508c7dd4c2349d8b3a7ec7c62c3102
Created January 3, 2019 20:08 — forked from dsyme/gist:9b18608b78dccf92ba33
Working self-contained getting-started sample for Suave Web Scripting
//==========================================
// Working fully self-contained getting-started example for Suave Web Server scripting
//
// Note you don't need to have _anything_ installed before starting with this script. Nothing
// but F# Interactive and this script.
//
// This script fetches the Paket.exe component which is referenced later in the script.
// Initially the #r "paket.exe" reference is shown as unresolved. Once it has been
// downloaded by the user (by executing the first part of the script) the reference
// shows as resolved and can be used.
@goswinr
goswinr / App.fs
Created January 14, 2019 16:25 — forked from mathias-brandewinder/App.fs
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
@goswinr
goswinr / Deploy.md
Created February 7, 2019 08:56 — forked from alfonsogarciacaro/Deploy.md
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)