Skip to content

Instantly share code, notes, and snippets.

View j1mmie's full-sized avatar

Jimmie Tyrrell j1mmie

View GitHub Profile
@bestknighter
bestknighter / DebugNode.hlsl
Last active February 23, 2024 09:56 — forked from aras-p/DebugNode.hlsl
"Print a value" custom function node code for Unity ShaderGraph, aware of +Inf/-Inf and nan
// This gist can be found at https://gist.github.com/bestknighter/660e6a53cf6a6643618d8531f962be2c
// I modified Aras Pranckevičius's awesome shader code to be able to handle Infinite and Not A Number numbers
// Tested on Unity 2023.1.0a15 with ShaderGraph 15.0.1.
// Quick try at doing a "print value" node for Unity ShaderGraph.
//
// Use with CustomFunction node, with two inputs:
// - Vector1 Value, the value to display,
// - Vector2 UV, the UVs of area to display at.
@steven-schmoll-at
steven-schmoll-at / paths-of.ts
Last active February 23, 2024 16:17
A typescript type to extract the keys and sub-keys of objects as dot separated paths.
type CombineAll<T> = T extends {[name in keyof T]: infer Type} ? Type : never
type PropertyNameMap<T, IncludeIntermediate extends boolean> = {
[name in keyof T]: T[name] extends object ? (
SubPathsOf<name, T, IncludeIntermediate> | (IncludeIntermediate extends true ? name : never)
) : name
}
type SubPathsOf<key extends keyof T, T, IncludeIntermediate extends boolean> = (
`${string & key}.${string & PathsOf<T[key], IncludeIntermediate>}`
@sindresorhus
sindresorhus / esm-package.md
Last active June 25, 2024 14:53
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@aras-p
aras-p / DebugNode.hlsl
Created January 3, 2020 10:37
"Print a value" custom function node code for Unity ShaderGraph
// Quick try at doing a "print value" node for Unity ShaderGraph.
// Tested on Unity 2019.2.17 with ShaderGraph 6.9.2.
//
// Use with CustomFunction node, with two inputs:
// - Vector1 Value, the value to display,
// - Vector2 UV, the UVs of area to display at.
// And one output:
// - Vector4 Color, the color.
// Function name is DoDebug.
@JonathanReid
JonathanReid / SpriteCreator
Last active June 17, 2024 07:34
SpriteCreator, a runtime atlassing system for Unity Sprites.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
/// <summary>
/// SpriteCreator, a runtime atlassing system for Unity Sprites.
/// Tries to not create any unneccessary textures, cleans all references when Flushed.
/// Can use with or without the atlassing, just call AddToAtlas and Build when using atlasses.
/// Full control over which atlases to add images to.