Skip to content

Instantly share code, notes, and snippets.

View aspnetde's full-sized avatar

Thomas Bandt aspnetde

View GitHub Profile
@aspnetde
aspnetde / demo.fsx
Created May 7, 2017 21:13
F# Interactive -> System.BadImageFormatException (Mono)
#r "System.Net.Http"
open System.Net.Http
type Foo = Foo of HttpRequestMessage
@aspnetde
aspnetde / ggt.fsx
Created June 20, 2017 21:54
Erweiterter Euklidischer Algorithmus
let rec ggT a b =
let r = a % b
if r = 0 || r = b then
b, 0, 1
else
let q = a / b
let g, s, t = ggT b r
g, t, s - q * t
namespace Foo
module Bar =
let RelationsReducer (state:RelationState) action =
match action with
| ActivitiesRequestSucceeded (id, items)
-> { state with FacilityActivity = state.FacilityActivity |> Array.filter (fun (f, _) -> f <> id)
|> Array.append (items |> Array.map (fun item -> (id, item.Id))) }
| _ -> state
@aspnetde
aspnetde / App.fs
Last active March 12, 2022 12:24
namespace FabulousSubModules
open Fabulous.Core
open Fabulous.DynamicViews
open Xamarin.Forms
module App =
type Model =
{ Global: GlobalModel
Page1: Page1.Model
namespace MvuCsharp
{
public class Cmd
{
public static readonly Cmd None = new Cmd();
public static Cmd OfMsg(IMessage msg) => new Cmd(); // TODO
}
}
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<hitlist>
<connectionString>" &amp; Session("defaultConnectionString") &amp; "</connectionString>
<hitlistDataSource>ViewAcciadoAdminHitlistArticles</hitlistDataSource>
<hitlistDataSourceOrphaned>ViewAcciadoAdminArticlesWithoutReferences</hitlistDataSourceOrphaned>
<recordsPerPage>25</recordsPerPage>
@aspnetde
aspnetde / foo.md
Last active November 2, 2020 16:11
Setting a fucking environment variable on macOS

Setting a fucking environment variable on macOS

  1. Open Vim (vi ~/.zshrc)

  2. Add the entry (i)

  3. Exit (Esc + :wq)

  4. Refresh (source ~/.zshrc)

@aspnetde
aspnetde / App.fs
Last active February 13, 2022 21:33
Feliz – MVU with React Function Components
module App
open Elmish
type State =
{ CurrentUser: string option }
type Msg =
| SignIn of string
| SignOut

Constraints:

  • Production = Google Play + Apple AppStore.
  • AppStore requires a manual review by Apple which can last between a couple of hours and a couple of days. It is not guaranteed to succeed, releases can be rejected.
  • It is not possible to put multiple releases in a queue – it is only possible to have one in review at Apple at a time.
  • There is no roll-back possible.
  • There will always be multiple release versions in use in parallel.

Goals:

@aspnetde
aspnetde / mvu.tsx
Created September 6, 2020 22:23
Pragmatic MVU With React And TypeScript
import React, { useReducer } from "react";
interface State {
userName: string;
password: string;
isValid: boolean;
}
const initialState: State = {
userName: "",