Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View yangruihan's full-sized avatar
📖
Studying...

Ryan yangruihan

📖
Studying...
  • Tencent
  • Shen Zhen, China
View GitHub Profile
@yangruihan
yangruihan / global.h
Created December 30, 2020 01:42
md5 extension
/* GLOBAL.H - RSAREF types and constants
*/
/* PROTOTYPES should be set to one if and only if the compiler supports
function argument prototyping.
The following makes PROTOTYPES default to 0 if it has not already
been defined with C compiler flags.
*/
#ifndef PROTOTYPES
#define PROTOTYPES 0
@yangruihan
yangruihan / NonDirectionalBooleanMatrix.cs
Created December 15, 2020 09:59 — forked from eral/NonDirectionalBooleanMatrix.cs
Property Drawer Like Layer Collision Matrix
// (C) 2018 ERAL
// Distributed under the Boost Software License, Version 1.0.
// (See copy at http://www.boost.org/LICENSE_1_0.txt)
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
@yangruihan
yangruihan / delete_git_submodule.md
Created November 11, 2020 03:09 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@yangruihan
yangruihan / EventDispatcher.cs
Last active May 6, 2022 16:15
C# Unity Event Dispatcher
using System;
using System.Collections.Generic;
using UnityEngine;
public delegate void EventHandler(short type);
public delegate void EventHandler<in T>(short type, T data);
public class EventDispatcher
{
using UnityEngine.UI;
public class NonDrawingGraphic : Graphic
{
public override void SetMaterialDirty() { return; }
public override void SetVerticesDirty() { return; }
protected override void OnPopulateMesh(VertexHelper vh)
{
vh.Clear();
@yangruihan
yangruihan / GameUtility_cs4.cs
Last active April 28, 2019 13:45
游戏工具类
using UnityEngine;
using System.IO;
using System.Linq;
using System;
public static class GameUtility
{
public const string AssetsFolderName = "Assets";
public static string FormatToUnityPath(string path)
@yangruihan
yangruihan / SingletonMono.cs
Last active February 15, 2019 08:15
MonoBehaviour 单例
using UnityEngine;
/// <summary>
/// extends this class to become singleton class.
/// </summary>
/// <typeparam name="T"> T is a SingletonMono class </typeparam>
public class SingletonMono<T> : MonoBehaviour where T : SingletonMono<T>
{
private static T _instance;
@yangruihan
yangruihan / BindBase.cs
Last active February 15, 2019 04:26
自动绑定 Inspector 脚本
using System;
using System.Reflection;
using System.Text;
using UnityEngine;
public class BindBase : MonoBehaviour
{
#if UNITY_EDITOR
private UnityEngine.Object FindComponentInObj(string name, Type type, bool showError = true)
{
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================
# System Required: Debian/Ubuntu
# Description: TCP-BBR
# Version: 1.0.22
# Author: Toyo
# Blog: https://doub.io/wlzy-16/
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================
# System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+
# Description: Install the ShadowsocksR server
# Version: 2.0.38
# Author: Toyo
# Blog: https://doub.io/ss-jc42/