Skip to content

Instantly share code, notes, and snippets.

View ww9's full-sized avatar
When everything hangs on a single moment, be sure you choose the right moment.

ww9

When everything hangs on a single moment, be sure you choose the right moment.
View GitHub Profile
@omar2205
omar2205 / main.ts
Created February 15, 2023 07:39
Parse FormData with Zod
// Using Deno :P
import { z } from 'npm:zod'
const User = z.object({
username: z.string(),
email: z.string().email()
})
function getMissingFields(error: z.ZodError): string[] {
const missingFields: string[] = []
@davidfowl
davidfowl / .NET6Migration.md
Last active October 23, 2024 18:30
.NET 6 ASP.NET Core Migration
@pardeike
pardeike / RimWorld_1.0_to_1.1.md
Last active January 1, 2024 09:49
How to update your Mod from RimWorld from 1.0 to 1.1 and Harmony 1.2.0.1 to 2.0

Updating RimWorld from 1.0 to 1.1

Introduction

My name is Andreas Pardeike, aka Brrainz, or the creator of Harmony. This guide is my personal attempt to help everyone through the journey of upgrading their mods. I am not affiliated with LUDEON studios or with developing RimWorld. It's just a personal thank you from me to the community.

Scope

This guide will help modders to update their C# mod to RimWorld 1.1. I will tell you how you upgrade to Harmony 2 and why. It will also serve as a guide to common changes that I encountered while I upgraded my own Camera+ mod. During the guide, I will use Visual Studio 2019. It's community edition is free. If you use a different IDE, please adapt your changes.

Composable Types

This proposal describes a new composable type system for Go. It follows the design ideas of the already built-in composable types map and chan and should be understood as an alternative way to implement basic generic data structures.

The following is an example of a queue implemented as a composable type (boring code has been removed):

func main() {
	// compose a queue of integers
	q := comp[int]Queue{}
@moyix
moyix / aigen.php
Last active April 26, 2023 19:14
PHP code generated by GPT-2
<?php
require ' vendor/autoload.php ' ;
/**
* Handles an HTTP request that contains information for registering/unregistering
* a FNA application.
@pardeike
pardeike / SimpleHarmonyTranspilerTutorial.md
Last active May 22, 2023 04:43
Simple Harmony Transpiler Tutorial

About
A hopefully easy tutorial on how to make a Transpiler with Harmony
Based on patching a method in the game RimWorld

Introduction

Writing transpilers is like writing a book about how to rewrite a cookbook to make it work for the age of microwave even if that cookbook was written before microwave ovens were invented. It requires good knowledge about the language the cookbook is written in and the topics and information models the cookbook author uses.

As such, writing a transpiler is way more complex and low level than writing a simple method that prefixes, postfixes or replaces an existing method. It is required to have good understanding in general C# programming and how to manipulate abstract data structures with respect to references and relative positioning. It also requires to know the language, in this case CIL, so you can manipulate the instructions without it to get into an illegal state.

@dtjm
dtjm / join_test.go
Last active July 23, 2024 19:31
Benchmarking various ways of concatenating strings in Go
package join
import (
"fmt"
"strings"
"testing"
)
var (
testData = []string{"a", "b", "c", "d", "e"}
@FaronBracy
FaronBracy / gist:25c77fc572794f7bcfe4
Created June 3, 2014 21:05
Camera class for XNA or MonoGame
using Microsoft.Xna.Framework;
namespace DreamersDesign
{
public class Camera
{
public Camera( int viewportWidth, int viewportHeight, Vector2 cameraPosition, ClockManager clockManager )
{
ViewportWidth = viewportWidth;
ViewportHeight = viewportHeight;
@dupuy
dupuy / README.rst
Last active October 21, 2024 22:20
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.