Skip to content

Instantly share code, notes, and snippets.

View akeit0's full-sized avatar

akeit0 akeit0

  • Tokyo
  • 05:37 (UTC +09:00)
View GitHub Profile
@akeit0
akeit0 / DefaultInterpolatedStringHandler.cs
Last active November 17, 2025 14:43
DefaultInterpolatedStringHandler for Unity
#define FILLATTRIBUTES // Uncomment this line to fill the attributes
//#define INTERNAL // Uncomment this line to make the class internal
#define TMP_INTERPOTATION_EXTENSIONS // Uncomment this line to add TMP extensions
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable enable
using System.Buffers;
using System.Diagnostics;
@akeit0
akeit0 / Program.cs
Last active February 27, 2025 14:28
What IL can do for generics constraints.
using System.Numerics;
using System.Runtime.CompilerServices;
using InlineIL;
//Not IDisposable
TestClass.DisposeTest(1);
//TestClass
Console.WriteLine(TestClass.Self(new TestClass()));
//Dispose
using System;
public class C {
public int M(int[,] array,int i,int j) {
return array[i,j];
}
public int M(int[][] array,int i,int j) {
return array[i][j];
}
using System;
public class Test
{
struct Struct()
{
public int A = 0;
}
public int IncrementSlow()
{
@akeit0
akeit0 / RomajiReader.cs
Last active August 15, 2024 00:22
RomajiReader Windowsの入力はおそらく全対応
//These codes are licensed under CC0.
using System;
using System.Collections.Generic;
//using RomajiReader;
// var reader = Reader.Default;
// Console.WriteLine(reader.Convert("shinkyoku"));//しゅんきょく
// Console.WriteLine(reader.Convert("kappa"));//かっぱ
// Console.WriteLine(reader.Convert("cinkya"));//しんきゃ
// Console.WriteLine(reader.Convert("rweqqap"));//rうぇっくぁp
// Console.WriteLine(reader.Convert("RWEQQAP"));//RうぇっくぁP
@akeit0
akeit0 / UnityConsoleRedirect.cs
Created August 10, 2024 08:30
ConsoleRedirect
//License
//These codes are licensed under CC0.
using System.IO;
using System.Text;
using UnityEngine;
static class ConsoleRedirect
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
static void ConsoleInit()
@akeit0
akeit0 / DefaultInterpolatedStringHandler.cs
Last active November 1, 2025 10:05
DefaultInterpolatedStringHandler for .netstandard2.1
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#nullable enable
using System.Buffers;
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
namespace System.Runtime.CompilerServices
@akeit0
akeit0 / DefaultInterpolatedStringHandler.NonGeneric.cs
Last active August 10, 2024 05:12
DefaultInterpolatedStringHandler for .netstandard2.1
namespace System.Runtime.CompilerServices
{
public ref partial struct DefaultInterpolatedStringHandler
{
public void AppendFormatted(float value)=> AppendFormatted(value, null);
public void AppendFormatted(int value)=> AppendFormatted(value, null);
public void AppendFormatted(double value)=> AppendFormatted(value, null);
/*
SharpLab tools in Run mode:
• value.Inspect()
• Inspect.Heap(object)
• Inspect.Stack(value)
• Inspect.MemoryGraph(value1, value2, …)
*/
using System;
using System.Collections;
using System.Linq;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
PArray<int> pArray=[1,2,3,4];
pArray[1..3]=[0,0];