Skip to content

Instantly share code, notes, and snippets.

View shiena's full-sized avatar

KOGA Mitsuhiro shiena

View GitHub Profile
@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";
@Refsa
Refsa / GrabScreenFeature.cs
Last active February 14, 2025 10:54
Unity URP custom grab pass
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class GrabScreenFeature : ScriptableRendererFeature
{
[System.Serializable]
public class Settings
@decoc
decoc / CompileLocker.cs
Last active February 11, 2023 08:48
This editor utility can lock/unlock unity script compile from menu item. See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile
using UnityEngine;
using UnityEditor;
/// <summary>
/// This editor utility can lock/unlock unity script compile from menu item.
/// See more https://raspberly.hateblo.jp/entry/InvalidateUnityCompile
/// </summary>
public static class CompileLocker
{
[MenuItem("Compile/Lock", false, 1)]
@layneson
layneson / build.zig
Created April 15, 2020 15:33
Custom step in build.zig
const std = @import("std");
const Builder = std.build.Builder;
const Step = std.build.Step;
pub fn build(b: *Builder) void {
const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const exe = b.addExecutable("hw", "hw.zig");
exe.setTarget(target);
@demonixis
demonixis / XRSubSystemTest.cs
Created January 13, 2020 13:28
A demonstration of how to use the all new XRSubsystem with Unity 2019.3+
using UnityEngine;
using UnityEngine.XR;
using UnityEngine.XR.Management;
public class XRSubSystemTest : MonoBehaviour
{
public void Start()
{
var xrSettings = XRGeneralSettings.Instance;
if (xrSettings == null)
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active April 8, 2025 14:18
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@voluntas
voluntas / saikyo.rst
Last active September 13, 2023 02:33
ぼくのかんがえたさいきょうの超低遅延大規模配信

ぼくのかんがえたさいきょうの超低遅延大規模配信

更新:2018-08-20
作者:@voluntas
バージョン:18.8.3
URL:https://voluntas.github.io/
@tarukosu
tarukosu / cameraToWorld.cs
Last active November 30, 2022 17:40
HoloLens カメラ座標から世界座標への変換
void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame)
{
Matrix4x4 cameraToWorldMatrix;
photoCaptureFrame.TryGetCameraToWorldMatrix(out cameraToWorldMatrix);
Matrix4x4 projectionMatrix;
photoCaptureFrame.TryGetProjectionMatrix(out projectionMatrix);
var imagePosZeroToOne = new Vector2(pixelPos.x / imageWidth, 1 - (pixelPos.y / imageHeight));
var imagePosProjected = (imagePosZeroToOne * 2) - new Vector2(1, 1); // -1 to 1 space
@sh-akira
sh-akira / KeyboardAction.cs
Created July 28, 2018 17:28
Unity Keyboard Event Sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
public class KeyboardEventArgs : EventArgs
{
public int KeyCode { get; }
@radiatoryang
radiatoryang / SmoothVideoPlaylist.cs
Last active March 27, 2025 16:07
short Unity C# script example for smoothly cutting / playing a playllist of VideoClips, by using one VideoPlayer (activeCam) to play the video and another VideoPlayer (otherCam) to cue up the next video... MIT License.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
public class SmoothVideoPlaylist : MonoBehaviour {
// to smoothly cut between two videos, we need two VideoPlayers
// make sure you create two VideoPlayers and assign them in the Inspector
public VideoPlayer activeCam, otherCam;