Skip to content

Instantly share code, notes, and snippets.

View 20chan's full-sized avatar
๐ŸŽธ
rockin'

20chan 20chan

๐ŸŽธ
rockin'
View GitHub Profile
@20chan
20chan / InspectorExtender.cs
Last active November 8, 2019 06:50
Unity inspector extender - show properties (get/set/ref get) and simply invokable methods in inspector
using System;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
[CanEditMultipleObjects]
@20chan
20chan / RandomRateObject.cs
Last active August 28, 2019 08:27
Random rated object picker unity extension
using System;
using Object = UnityEngine.Object;
using Random = UnityEngine.Random;
[Serializable]
public class RandomRateObject<T> : RandomRateObjectBase where T : Object {
// rates.Length + 1 = objects.Length
public float[] rates = new float[0];
public T[] objects = new T[1];
@20chan
20chan / GameViewAutoScaler.cs
Created August 28, 2019 08:25
unity set game view window scale to min when played
using System.Reflection;
using UnityEngine;
namespace Common {
public class GameViewAutoScaler : MonoBehaviour {
#if UNITY_EDITOR
private void Awake() {
SetGameViewScaleMin();
}
@20chan
20chan / horribleEvent.cs
Created September 5, 2019 05:39
C# horrible event auto property
public event Action<bool> OnGameOver {
add => ((ITriggeringGimmick)triggering).OnGameOver += value;
remove => ((ITriggeringGimmick)triggering).OnGameOver -= value;
}
@20chan
20chan / readme.md
Last active February 4, 2021 02:03
์œ ๋‹ˆํ‹ฐ ์ง๋ ฌํ™” ๋ฐฉ์‹๊ณผ null ์‚ฌ์šฉ์˜ ๊ฐœ๊ฐ™์Œ๊ณผ ๋ฒ„๊ทธ

์œ ๋‹ˆํ‹ฐ์—์„œ Object ํด๋ž˜์Šค๋Š” (System.Object๊ฐ€ ์•„๋‹˜) == ์˜คํผ๋ ˆ์ดํ„ฐ์™€ implicit bool ์บ์ŠคํŒ… ์˜คํผ๋ ˆ์ดํ„ฐ๋ฅผ ์˜ค๋ฒ„๋ผ์ด๋“œํ•œ๋‹ค. ์ด๊ฒŒ ์ง„์ž ๋ง๋„ ์•ˆ๋œ๋‹ค

2018.3.0f2 ๋ฒ„์ ผ์ด๊ณ  ์ฝ”๋“œ๋Š” Jetbrain Rider ๋กœ ๋””์ปดํŒŒ์ผํ•œ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉ

์ •์˜๋œ ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค:

public static bool operator ==(Object x, Object y)
{
  return Object.CompareBaseObjects(x, y);
@20chan
20chan / .editorconfig
Created October 27, 2019 12:40
Generated C# .editorconfig, Visual Studio 2019 16.3.6, Korean
# ์ƒ์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ .editorconfig ์„ค์ •์„ ์ƒ์†ํ•˜๋ ค๋ฉด ์•„๋ž˜ ํ–‰์„ ์ œ๊ฑฐํ•˜์„ธ์š”.
root = true
# C# ํŒŒ์ผ
[*.cs]
#### ์ฝ”์–ด EditorConfig ์˜ต์…˜ ####
# ๋“ค์—ฌ์“ฐ๊ธฐ ๋ฐ ๊ฐ„๊ฒฉ
indent_size = 4
@20chan
20chan / ytmusic.ipynb
Created November 13, 2019 01:53
dotnet try jupyter notebook example for C# youtube music control with Puppeteersharp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@20chan
20chan / readme.md
Created November 29, 2019 02:48
Use RadialController (and other UWP apis) in winform

UWP in Winform

์›๋ž˜ TargetPlatform์„ 8 ์ด์ƒ์œผ๋กœ ํ•˜๊ณ  Windows SDK๊ฐ€ ๊น”๋ ค์ž‡๋‹ค๋ฉด VS ์ฐธ์กฐ ํƒญ์—์„œ ์™ผ์ชฝ์— Windows SDK๊ฐ€ ๋œจ๊ณ  ๊ฑฐ๊ธฐ์— dll๋“ค์ด ๋œจ๋‚˜๋ณด๋‹ค ๊ทผ๋ฐ Windows SDK๋งŒ ๋œจ๊ณ  ์•ˆ์— ์—†๋‹ค๊ณ  ๋œธ SDK๋„ ์„ค์น˜๋˜์–ด์žˆ๋Š”๋ฐ

๊ทธ๋ž˜์„œ ์ฐพ์•„๋ณด๋‹ˆ๊นŒ https://developercommunity.visualstudio.com/content/problem/608833/no-references-were-found-in-the-windows-sdk.html ์ด๊ฒŒ ์œˆ๋„์šฐ 1903 ๋ฒ„๊ทธ๋ผ๊ณ  ์‹ฌ์ง€์–ด ํ•œ ์Šคํƒ์˜ค๋ฒ„ํ”Œ๋กœ์šฐ ์งˆ๋‹ต ์—์„œ๋Š” ์œˆ๋„์šฐ๋ฅผ 1803์œผ๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œํ•˜์„ธ์š”! ๋ผ๋Š” ๋‹ต๋ณ€์ด ์ฑ„ํƒ๋˜์—ˆ๋‹ค

@20chan
20chan / register.py
Created February 5, 2020 16:20
python custom codec meta programming post example aheui code
import codecs, io, encodings
from encodings import utf_8
aheui_code = '''
'''
def aheui_decode(input, errors="strict"):
raw = bytes(input).decode("utf-8")
code = "\n".join(raw.splitlines()[1:])
hooked = aheui_code + f'eval("""{code}""")'
@20chan
20chan / DamnUnityCoroutine.cs
Last active February 17, 2020 09:58
Unity StopCoroutine doesn't work at all in nested Coroutine but it is ambiguous
using System.Collections;
using Sirenix.OdinInspector;
using UnityEngine;
public class DamnUnityCoroutine : MonoBehaviour {
private Coroutine coroutine;
[Button(ButtonSizes.Large)]
public void Go() {
coroutine = StartCoroutine(A());