Skip to content

Instantly share code, notes, and snippets.

@adibhanna
adibhanna / settings.json
Created April 18, 2024 17:56
zed settings
{
"theme": "Gruvbox Dark Hard",
"base_keymap": "VSCode",
"buffer_font_family": "BerkeleyMono Nerd Font",
"buffer_font_size": 15,
"vim_mode": true,
"relative_line_numbers": true,
"cursor_blink": false,
"scrollbar": {
"show": "never"
@davidfowl
davidfowl / .NET6Migration.md
Last active April 11, 2024 02:02
.NET 6 ASP.NET Core Migration
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 18, 2024 18:28
Minimal APIs at a glance
// บอทปั้มเงิน TLM เกม Alien Worlds (เงินจะเอาไปแลกเงินจริงใน Binance ได้)
// ไว้ทดสอบเฉย ๆ อย่าเอาไปใช้จริง คนเขียนไม่รับผิดชอบต่อบั๊กใด ๆ ทั้งสิ้น
//
// วิธีใช้:
// 1. สมัคร + เข้า https://play.alienworlds.io/
// 2. ต้องเคย mine แบบ manual ก่อน 1 ครั้ง
// 3. ก๊อปสคริปท์นี้ไปแปะใน Console (F12)
// น่าจะมีบั๊กพวก rate limit อะไรทั้งหลาย กับ if/loop บางอันเอาออกได้
// ลองรันเล่น ๆ 5 ชม จาก user เปล่า ๆ ได้มา 8 TLM (ขึ้นกับดวงและอื่นๆด้วยมั่ง)
// ใครว่าง ๆ แก้เป็นยิงเข้า API โดยตรงไม่ผ่าน JS น่าจะเสถียรกว่าเยอะมาก
@richlander
richlander / modernizing-csharp9.md
Last active April 26, 2024 17:14
Modernizing a codebase for C# 9

Modernizing a codebase for C# 9

There are lots of cases that you can improve. The examples use nullable reference types, but only the WhenNotNull example requires it.

Use the property pattern to replace IsNullorEmpty

Consider adopting the new property pattern, wherever you use IsNullOrEmpty.

string? hello = "hello world";
@alfonsogarciacaro
alfonsogarciacaro / Deploy.md
Last active March 3, 2023 09:50
Deploying an F# ASP.NET Core app (Giraffe) to Azure

Deploying an F# ASP.NET Core app to Azure

Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)

Preparation

The following steps are mostly taken from this guide and it's only necessary to do them once:

  1. Create an account in Azure (or use an existing one)
  2. Create a resource group (or use an existing one)
@haf
haf / A vision for F#.md
Last active March 27, 2018 00:46
A vision for F#

What should F# as a language contain?

  • A default test framework like Expecto
  • A default HTTP client like HTTP.fs
  • A default web framework like Suave
  • A default JS framework like Fable
  • A default logging framework like Logary
  • A default character parser combinator library like FParsec
  • A default binary parser combinator library like FsAttoparsec
  • A default concurrent programming framework like Hopac

packages:

  • id: MathNet.Numerics.Core version: 3.17.0
  • id: OxyPlot.Core version: 2.0.0-unstable1013 uti: com.xamarin.workbook id: 744cd41b-7a5b-44a4-b17d-80a4297f0fc3 title: computation-expression platforms:
@mashingan
mashingan / matchmacro.nim
Created September 11, 2017 07:17
defining match syntax using Nim macro
import macros
macro match(head, body: untyped): untyped =
result = newNimNode nnkStmtList
var casenode = newNimNode nnkCaseStmt
casenode.add head
for node in body:
node.expectKind nnkInfix
@freestylecoder
freestylecoder / Program.cs
Last active May 20, 2016 14:01
Passing F# With to C#
using System;
using Types;
namespace App {
class Program {
static void Main( string[] args ) {
Tag testTag = new Tag( 1, "Original" );
Console.WriteLine( "{0}: {1}", testTag.Id, testTag.Text );
Tag newTag = testTag.With( nameof( testTag.Id ), 2 ).With( nameof( testTag.Text ), "New One" );
Console.WriteLine( "{0}: {1}", newTag.Id, newTag.Text );