Skip to content

Instantly share code, notes, and snippets.

View ghiboz's full-sized avatar
🍺
Focusing

Paolo Ghibaudo ghiboz

🍺
Focusing
View GitHub Profile
@sinbad
sinbad / SpriteMeshRaycastFilter.cs
Last active May 11, 2023 05:35
SpriteMeshRaycastFilter: easy Unity UI non-rectangular click detector without reading textures
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// Restrict raycasting to a sprite mesh shape
// Could use Image.alphaHitTestMinimumThreshold to mask but that requires read/write images which can't be packed
[RequireComponent(typeof(Image))]
public class SpriteMeshRaycastFilter : MonoBehaviour, ICanvasRaycastFilter {
private RectTransform rectTransform;
@LotteMakesStuff
LotteMakesStuff / CustomInspectorCreator.cs
Last active May 23, 2024 22:06
Editor extension that adds a tool to automagically generate boilerplate custom inspector code~ YES! Just drop it into a folder called 'Editor' and it adds a 'custom inspector' option into the Project window!
using UnityEngine;
using UnityEditor;
using System.IO;
public static class CustomInspectorCreator
{
[MenuItem("Assets/Create/Custom Inspector", priority = 81)]
static void CreateInsptorEditorClass()
{
foreach (var script in Selection.objects)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\Unity5]
@=""
"Icon"="%ProgramFiles%\\Unity\\Editor\\Unity.exe"
"MUIVerb"="Open as Unity Project"
[HKEY_CLASSES_ROOT\Folder\shell\Unity5\Command]
@="cmd /c start /D\"c:\\Program Files\\Unity\\Editor\\\" Unity.exe -projectPath \"%1\""
@roundand
roundand / OpenWithSublimeText3.bat
Last active March 13, 2024 17:38 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
/// <summary>
/// Given a 180mb NuGet package, NuGet.Core's PackageManager uses 1.17GB of memory and 55 seconds to extract it.
/// This is because it continually takes package files and copies them to byte arrays in memory to work with.
/// This class simply uses the packaging API's directly to extract, and only uses 6mb and takes 10 seconds on the
/// same 180mb file.
/// </summary>
public class LightweightPackageInstaller
{
private static readonly string[] ExcludePaths = new[] { "_rels", "package\\services\\metadata" };
@joelverhagen
joelverhagen / README.md
Created February 12, 2012 02:14
Jekyll YouTube Embed Plugin

This is a plugin meant for Jekyll.

Example use:

Easily embed a YouTube video. Just drop this file in your _plugins directory.

{% youtube oHg5SJYRHA0 %}