Skip to content

Instantly share code, notes, and snippets.

@mrange
mrange / starry.glsl
Created Feb 10, 2021
starry apollian
View starry.glsl
// Licence CC0: Tunneling through appollian fractal
// -----------------------------------------------------------------------------
// COMMON
// -----------------------------------------------------------------------------
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME time
#define RESOLUTION resolution
@mrange
mrange / golden.glsl
Last active Feb 10, 2021
Golden apollian
View golden.glsl
// Licence CC0: Tunneling through golden appollian fractal II
// -----------------------------------------------------------------------------
// COMMON
// -----------------------------------------------------------------------------
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME time
#define RESOLUTION resolution
View tinkering.glsl
// Licence CC0: Tunneling through appollian fractal
// -----------------------------------------------------------------------------
// COMMON
// -----------------------------------------------------------------------------
#define PI 3.141592654
#define TAU (2.0*PI)
#define TIME time
#define RESOLUTION resolution
@mrange
mrange / core.fs
Last active Jan 1, 2021
F# Dependencies
View core.fs
namespace FsDepedencies
module Core =
open FSharp.Linq.RuntimeHelpers
open FSharp.Quotations
open FSharp.Quotations.Patterns
open System
open System.Collections.Generic
@mrange
mrange / parser.cs
Last active Dec 16, 2020
C# Parser
View parser.cs
#nullable disable
namespace CsJsonToCs
{
using System;
public struct Option<T>
{
public readonly bool HasValue;
public readonly T Value ;
@mrange
mrange / dep.fs
Created Dec 6, 2020
Testing ideas wrt to DI in F#
View dep.fs
module Log =
open Printf
type LogLevel =
| Meltdown = 0b00000001
| Error = 0b00000010
| Warning = 0b00000100
| Info = 0b00001000
| Success = 0b00010000
@mrange
mrange / aoc_05.fs
Created Dec 6, 2020
Advent of Code
View aoc_05.fs
[<EntryPoint>]
let main argv =
let parseBoardingPass (boardingPass : string) =
let bn = boardingPass.Replace('F', '0').Replace('L', '0').Replace('B', '1').Replace('R', '1')
let sid = System.Convert.ToInt32(bn, 2)
sid/8, sid%8, sid
let testCases =
[|
"FBFBBFFRLR", (44 , 5, 357)
@mrange
mrange / cel.cpp
Last active Dec 6, 2020
Church Encoded Lists C++
View cel.cpp
// https://godbolt.org/z/55frxc
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <utility>
#include <vector>
#include <type_traits>
#define CPP_CEL__FORWARD(v) std::forward<decltype(v)>(v)
@mrange
mrange / 0.md
Last active Dec 6, 2020
F# Advent 2020, Dec 6 - Church Encoded Lists
View 0.md

F# Advent 2020, Dec 6 - Church Encoded Lists

Introduction

The purpose of abstraction is not to be vague, but to create a new semantic level in which one can be absolutely precise

Edsger W. Dijkstra

This is my contribution to F# Advent Calendar in English. Thanks to Sergey Tihon for making sure this happens every year.

View layers.glsl
#version 150
uniform float time;
uniform vec2 resolution;
uniform vec2 mouse;
uniform vec3 spectrum;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;