Skip to content

Instantly share code, notes, and snippets.

View dallinbeutler's full-sized avatar

Dallin Beutler dallinbeutler

View GitHub Profile

Priorities

  • easy Monad application, ordering, and usage
  • easy function currying (front,back, whatever)
  • static typing
  • easy and readable scoping (.operators, pointer operators)?
  • inline lambdas identical to function declarations
  • emphasis on pure function usage and visibility (make side-effects like exceptions stick out like a sore thumb)
  • first class macros based on language AST rather than text (T4/TT like)(the main issue with C macros)
  • lowest possible interop cost to C (possible inline C usage to prep binding? not ideal and not preferable)
  • easy pooling
@dallinbeutler
dallinbeutler / EasingFunctionsV2.fs
Created October 13, 2019 17:18
A more generic approach to the easing functions
// Credit to lionliam96 for initial port
// t- Current Time
// b- start value
// c- change in value
// d- duration
module EasingFunctions
open System
let inline private two() = LanguagePrimitives.GenericOne + LanguagePrimitives.GenericOne
@dallinbeutler
dallinbeutler / EasingFunctions.fs
Created October 8, 2019 02:44
all the standard easing functions. There is room for optimization.
// Credit to lionliam96 for initial port
// t- Current Time
// b- start value
// c- change in value
// d- duration
module EasingFunctions
open System
(*---------------------------- LINEAR ---------------------------*)
@dallinbeutler
dallinbeutler / TimeLiningIdeas.fs
Created July 17, 2019 23:30
An Idea for dispatching Elmish events via a scrubbable timeline
//It all depends on where i call what the return shoud be...
// unit would be easiest with preapplied dispatcher
type Disp= unit->unit
//type Disp= unit->msg
type Event(dispatch:Disp, elapsedTime: int64 )=
member this.Msg = dispatch
member this.Time = elapsedTime
member this.Equals (obj) = false
@dallinbeutler
dallinbeutler / viewInteropIdeas.fs
Created July 17, 2019 23:07
Some Ideas on how a main Program might communicate with its view
open System
type Resource =
|Texture of string
|Sound of string
|Model of string
|Data of string * System.Type
|Pipeline of Veldrid.Pipeline
module Draw3D =
@dallinbeutler
dallinbeutler / newThreadRender.fs
Created July 17, 2019 23:04
add any number of views to your Elmish program
// a cheesy workaround to pass the resulting view as a message to a view program, then vice versa
// call this last because it starts 2 listener threads.
let WithViewSub
(viewToVMsg)
(viewToPMsg)
vargs
(vprog :Program<'vinit,'vstate,'vmsg,'vview>)
(prog :Program<'init,'state,'msg,'view>)
=
let vmsgagent = MailboxProcessor.Start(fun inbox ->
@dallinbeutler
dallinbeutler / VeldridImGUI.fs
Created July 9, 2019 18:21
a simple example to get a graphical or game window and GUI going in F# with Veldrid and ImGUI
module ElmEye
open Veldrid
open Veldrid.StartupUtilities
let CreateApp windowWidth windowHeight name =
let windowCI = WindowCreateInfo(
X = 400,
Y =400,
WindowWidth = windowWidth,
WindowHeight = windowHeight,
@dallinbeutler
dallinbeutler / CubesDefinitions.cs
Created May 17, 2019 23:42
3 ways to map a 3d cube buffer based on the type of draw call (C# and OpenGL ( via Veldrid))
//Triangle Strip (no index, fastest)
new VertexPositionTexture(new Vector3(-0.5f, 0.5f, 0.5f), new Vector2(0, 0)), //ftl front top left
new VertexPositionTexture(new Vector3( 0.5f, 0.5f, 0.5f), new Vector2(1, 0)), //ftr
new VertexPositionTexture(new Vector3(-0.5f, -0.5f, 0.5f), new Vector2(0, 1)), //fbl
new VertexPositionTexture(new Vector3( 0.5f, -0.5f, 0.5f), new Vector2(1, 1)), //fbr front bottom right
new VertexPositionTexture(new Vector3( 0.5f, -0.5f, -0.5f), new Vector2(1, 0)), //bbr
new VertexPositionTexture(new Vector3( 0.5f, 0.5f, 0.5f), new Vector2(0, 1)), //ftr
new VertexPositionTexture(new Vector3( 0.5f, 0.5f, -0.5f), new Vector2(0, 0)), //btr
new VertexPositionTexture(new Vector3(-0.5f, 0.5f, 0.5f), new Vector2(1, 1)), //ftl
new VertexPositionTexture(new Vector3(-0.5f, 0.5f, -0.5f), new Vector2(1, 0)), //btl
@dallinbeutler
dallinbeutler / wallpaper.cs
Created April 9, 2019 19:08
Bypass IT enforced wallpaper to your own
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace MyWallpaper
@dallinbeutler
dallinbeutler / CsvToXlsx.cs
Created April 9, 2019 18:26
convert csv to xlsx C# without interop
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Linq;
using ClosedXML;
namespace CSVToXLSX
{