Skip to content

Instantly share code, notes, and snippets.

/// <summary>
/// Checks whether string is null, empty or consists of whitespace chars.
/// </summary>
public static bool IsNullEmptyOrWhiteSpace (string content)
{
if (String.IsNullOrEmpty(content))
return true;
return String.IsNullOrEmpty(content.TrimFull());
}
@elringus
elringus / Program.cs
Created June 25, 2018 07:31
Stubble render empty lines for non-existing tags
using Stubble.Core.Builders;
using System;
class Program
{
static string template =
@"Lorem ipsum dolor sit amet, consectetur adipiscing elit.
{{{ATag}}}
{{{ATag}}}
{{{ATag}}}
#if LIVE2D_AVAILABLE
using Live2D.Cubism.Core;
using Live2D.Cubism.Framework;
using System.Collections.Generic;
using System.Linq;
using UnityCommon;
using UnityEngine;
namespace Naninovel
using UnityEngine.Tilemaps;
using BlendModes;
[ExtendedComponent(typeof(TilemapRenderer))]
public class TilemapRendererExtension : RendererExtension<TilemapRenderer>
{
public override string[] GetSupportedShaderFamilies ()
{
return new[] {
"SpritesDefault"
Shader "BlendOp"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
[Enum(UnityEngine.Rendering.BlendOp)] _BlendOp("Blend Operation", Float) = 0.0
[Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("Source Blend", Float) = 1.0
[Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("Destination Blend", Float) = 1.0
}
@elringus
elringus / rfc5646-language-tags.js
Created December 14, 2018 17:14 — forked from msikma/rfc5646-language-tags.js
RFC 5646 Language Tags
// List of language tags according to RFC 5646.
// See <http://tools.ietf.org/html/rfc5646> for info on how to parse
// these language tags. Some duplicates have been removed.
var RFC5646_LANGUAGE_TAGS = {
'af': 'Afrikaans',
'af-ZA': 'Afrikaans (South Africa)',
'ar': 'Arabic',
'ar-AE': 'Arabic (U.A.E.)',
'ar-BH': 'Arabic (Bahrain)',
'ar-DZ': 'Arabic (Algeria)',
@elringus
elringus / RenderMyCustomPass.cs
Last active September 27, 2024 03:44
Example for adding custom render passes via renderer features for lightweight render pipeline (LWRP)
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.LWRP;
// Inheriting from `ScriptableRendererFeature` will add it to the
// `Renderer Features` list of the custom LWRP renderer data asset.
public class RenderMyCustomPass : ScriptableRendererFeature
{
private class MyCustomPass : ScriptableRenderPass
{
Shader "Custom/UnlitAlphaRotation"
{
Properties
{
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_RotationY("Rotation over Y-axis", Range(0, 360)) = 45
}
SubShader
@elringus
elringus / Item.cs
Last active November 21, 2020 13:28
[System.Serializable]
public class Item
{
private string value = null;
public void SetValue (string value) => this.value = value;
public string GetValue () => value;
}
@elringus
elringus / FileWatcher.cs
Last active November 1, 2024 05:53
Allows executing an editor behaviour in response to file modificatons, even when editor application is not in focus.
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
/// <summary>
/// Uses file system watcher to track changes to specific files in the project directory.