Skip to content

Instantly share code, notes, and snippets.

Avatar

Thomas Bandt aspnetde

View GitHub Profile
View JsonSerializer.fs
namespace Infrastructure
open System.Text.Encodings.Web
open System.Text.Json
open System.Text.Json.Serialization
[<RequireQualifiedAccess>]
module JsonSerializer =
let private setupOptions (options: JsonSerializerOptions) =
options.PropertyNamingPolicy <- JsonNamingPolicy.CamelCase
View serialization.fs
namespace Foo
open System.Text.Encodings.Web
open System.Text.Json
open System.Text.Json.Serialization
[<RequireQualifiedAccess>]
module JsonSerializer =
let private setupOptions (options: JsonSerializerOptions) =
options.PropertyNamingPolicy <- JsonNamingPolicy.CamelCase
@aspnetde
aspnetde / compile-times.md
Last active April 6, 2021 07:34
F# vs. C# Compile Times
@aspnetde
aspnetde / useLocalStorage.ts
Created September 28, 2020 10:03
A Local Storage React Hook
View useLocalStorage.ts
export function useLocalStorage<T>(key: string, initialValue: T) {
const [storedValue, setStoredValue] = useState(() => {
try {
const item = window.localStorage.getItem(key);
return item ? (JSON.parse(item) as T) : initialValue;
} catch (error) {
console.log(error);
return initialValue;
}
});
@aspnetde
aspnetde / mvu.tsx
Created September 6, 2020 22:23
Pragmatic MVU With React And TypeScript
View mvu.tsx
import React, { useReducer } from "react";
interface State {
userName: string;
password: string;
isValid: boolean;
}
const initialState: State = {
userName: "",
View collaboration.md

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 / App.fs
Last active February 13, 2022 21:33
Feliz – MVU with React Function Components
View App.fs
module App
open Elmish
type State =
{ CurrentUser: string option }
type Msg =
| SignIn of string
| SignOut
@aspnetde
aspnetde / foo.md
Last active November 2, 2020 16:11
Setting a fucking environment variable on macOS
View foo.md

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)

View AcciadoArticles.config
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<hitlist>
<connectionString>" &amp; Session("defaultConnectionString") &amp; "</connectionString>
<hitlistDataSource>ViewAcciadoAdminHitlistArticles</hitlistDataSource>
<hitlistDataSourceOrphaned>ViewAcciadoAdminArticlesWithoutReferences</hitlistDataSourceOrphaned>
<recordsPerPage>25</recordsPerPage>
View Cmd.cs
namespace MvuCsharp
{
public class Cmd
{
public static readonly Cmd None = new Cmd();
public static Cmd OfMsg(IMessage msg) => new Cmd(); // TODO
}
}