Skip to content

Instantly share code, notes, and snippets.

@matthewzring
matthewzring / markdown-text-101.md
Last active July 29, 2024 05:03
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

@darkon76
darkon76 / OrtographicDrag.cs
Last active April 3, 2023 19:54
Unity Drag.
using UnityEngine;
using UnityEngine.EventSystems;
public class OrtographicDrag: MonoBehaviour, IDragHandler
{
private Camera _mainCamera;
public float DistanceToCamera;
public void OnDrag(PointerEventData eventData)
{
@yasirkula
yasirkula / EditorCollapseAll.cs
Last active March 11, 2024 11:53
An editor script for Unity 3D to collapse all GameObject's in Hierarchy view or to collapse all folders in Project view. See the comments section below for instructions.
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEditorInternal;
using UnityEngine.SceneManagement;
public static class EditorCollapseAll
{
private const BindingFlags INSTANCE_FLAGS = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
@tanaikech
tanaikech / submit.md
Last active June 12, 2024 09:50
Retrieving Named Functions from Google Spreadsheet using Google Apps Script

Retrieving Named Functions from Google Spreadsheet using Google Apps Script

This is a sample script for retrieving the named functions from Google Spreadsheet using Google Apps Script.

Recently, the named functions got to be able to be used in Google Spreadsheet. Ref When several named functions are added, I thought that I wanted to retrieve these functions using a script. But, unfortunately, in the current stage, it seems that there are no built-in methods (SpreadsheetApp and Sheets API) for directly retrieving the named functions. So, I created this sample script.

In this script, the following flow is run.

@karljj1
karljj1 / SerializedDictionaryExample.cs
Last active February 13, 2024 14:04
Serializing a Dictionary in a VisualElement (Unity 2023.2.0a9)
using System;
using System.Collections.Generic;
using UnityEngine.UIElements;
[Serializable]
class DictItem
{
public int key;
public string value;
}
@nomnomab
nomnomab / SimplifyEnum.cs
Created May 3, 2023 16:50
Unity editor enum compression for invalid states
private static class EnumCache<T> where T : Enum {
public static T[] Values { get; } = (T[])Enum.GetValues(typeof(T));
}
// 32-bit max enum simplification
private static int SimplifyEnum<T>(T e) where T: Enum {
var values = EnumCache<T>.Values;
var max = 0;
var number = Convert.ToInt32(e);