Skip to content

Instantly share code, notes, and snippets.

View weebs's full-sized avatar
💭
Just a doot dooter

weebs

💭
Just a doot dooter
View GitHub Profile
@weebs
weebs / srtp.fsx
Created July 1, 2024 03:15 — forked from michaeloyer/srtp.fsx
F# SRTP Example
// SRTP: Statically Resolved Type Parameters
// https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/generics/statically-resolved-type-parameters
// SRTP Allows for pulling members out of types that where the member is named and typed the same
// In this example SRTP will be used to pull out the 'First: string' and 'Last: string' members
// from different types
// One example of SRTP in the F# Base Class Library is the (+) operator.
// You'll see that it has this type signature:
<script>
var module = WebAssembly.instantiateStreaming(fetch("linked_list.wasm"), {});
</script>
@weebs
weebs / WebGPU.Quad.fs
Last active January 31, 2024 18:24
WebGPU F# Silk.NET Quad
module WebGPU
// <ItemGroup>
// <PackageReference Include="Silk.NET.GLFW" Version="2.20.0" />
// <PackageReference Include="Silk.NET.WebGPU" Version="2.20.0" />
// <PackageReference Include="Silk.NET.WebGPU.Native.WGPU" Version="2.20.0" />
// <PackageReference Include="Silk.NET.Windowing" Version="2.20.0" />
// </ItemGroup>
open Microsoft.FSharp.NativeInterop
@weebs
weebs / threejs.fs
Last active March 30, 2023 04:05
three.js bindings for Fable F# with various fixes
module rec threejs
#nowarn "3390" // disable warnings for invalid XML comments
#nowarn "0044" // disable warnings for `Obsolete` usage
open System
open Fable.Core
open Fable.Core.JS
open Browser.Types
@weebs
weebs / Program.fs
Last active March 27, 2023 23:58
F# + Silk.NET
open Microsoft.FSharp.NativeInterop
open Silk.NET.Maths
open Silk.NET.Windowing
open Silk.NET.Input;
open Silk.NET.OpenGL
open System
let VertexShaderSource = """
#version 330 core //Using version GLSL version 3.3
layout (location = 0) in vec4 vPos;
module LensPatternElmish.Client.Main
open Elmish
open Bolero
open Bolero.Html
open Bolero.Templating.Client
type eLens<'a, 'model> = unit -> 'a * ('a -> 'model)
type updater<'b, 'a> = 'b -> 'a -> 'a * Cmd<'b>
let inline delegateTo (elens: eLens<'a, 'model>) (update: updater<'b, 'a>) (msgType: 'b -> 'msg) (msg: 'b) : 'model * Cmd<'msg> =
@weebs
weebs / ableton-push-snake.js
Last active December 8, 2015 15:14
Ableton Push Snake Game
// Thank you git-moss for your Push4Bitwig script, as this was greatly helpful in learning how to
// control the LEDs/respond to input from the push. https://github.com/git-moss/Push4Bitwig
loadAPI(1);
load('Helpers.js');
host.defineController('WobbleSoft', 'Snake', '1.0', 'ebef3e20-6967-11e4-9803-0800200c9a66');
host.defineMidiPorts(1, 1);
host.addDeviceNameBasedDiscoveryPair (['Ableton Push User Port'], ['Ableton Push User Port']);