Skip to content

Instantly share code, notes, and snippets.

View AlbertoDePena's full-sized avatar

Alberto De Pena AlbertoDePena

  • Crane Worldwide Logistics
  • Willis, TX
View GitHub Profile
@TheAngryByrd
TheAngryByrd / program.fs
Last active April 14, 2022 04:29
F# MapGet helper
open System
open Microsoft.AspNetCore.Builder
open Microsoft.Extensions.Hosting
open Microsoft.AspNetCore.Http
open System.Threading.Tasks
let mapGet (pattern : string) handler (app : WebApplication) =
app.MapGet(pattern, (Func<_>(handler))) |> ignore
let mapGetAsync (pattern : string) (handler : HttpContext -> Task) (app : WebApplication) =
@alfonsogarciacaro
alfonsogarciacaro / ConsoleTracer.fs
Last active May 12, 2022 12:43
A cleaner console tracer for Elmish apps
module ConsoleTracer
open System
open Fable.Core
// Use it when initializing your Elmish app like this
//|> Program.withTrace ConsoleTracer.withTrace
let getMsgNameAndFields (t: Type) (x: 'Msg): string * obj =
let rec getCaseName (t: Type) (acc: string list) (x: obj) =
@kuznero
kuznero / Ctrl-C-Console-App.md
Last active May 18, 2021 18:13
Console application that exit on Ctrl-C (ready for Docker)

Console application that exit on Ctrl-C (ready for Docker)

Console.ReadLine or Console.ReadKey do not work as expected under Docker container environment. Thus, typical way to solve this would be to properly handle Ctrl-C key combination.

C# snippet

using System;
using System.Threading;
@evantoli
evantoli / GitConfigHttpProxy.md
Last active May 20, 2024 08:42
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like: