Skip to content

Instantly share code, notes, and snippets.

@birdinforest
birdinforest / BasisTextureLoader.js
Last active December 15, 2023 01:16
Decompress .basis compressed texture. #webgl #texture_compression #basisu #javascript #decompression
/* eslint-disable */
// const BASIS = require('./basis_transcoder');
import BASIS from './basis_transcoder/build/basis_transcoder.js';
/*global clay */
/**
* @typedef MipLevelInfo
* @property {number} level - Mip level
@birdinforest
birdinforest / memory-test.ts
Created September 12, 2020 05:35 — forked from connorjclark/memory-test.ts
memory leak test
import { ChildProcess, spawn } from 'child_process';
import * as puppeteer from 'puppeteer';
const DEBUG = Boolean(process.env.DEBUG);
const CI = Boolean(process.env.CI);
const QUERY = Boolean(process.env.QUERY);
jest.setTimeout((QUERY ? 200 : 100) * 1000);
interface MemorySample {
@birdinforest
birdinforest / install_commands.markdown
Last active February 26, 2018 08:19
Types install by npm
@birdinforest
birdinforest / .eslintrc.json
Created February 23, 2018 06:45
ESLint json for React, ES6, JSX.
{
"env": {
"browser": true,
"es6": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parserOptions": {
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
@birdinforest
birdinforest / .editorconfig
Created February 23, 2018 06:44
Editor config for react, http, ES5.
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
# Set default charset
@birdinforest
birdinforest / EditorTools
Last active October 26, 2016 04:41
EditorTools. Customized layerMaskFiled. Create layermask on inpsector. InternalEditorUtility.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using UnityEditorInternal;
public class EditorTools {
private static List<int> layerValues = new List<int>();
private static long lastUpdateTick;
private static string[] layers;
@birdinforest
birdinforest / TriggerHanlder.cs
Created October 20, 2016 07:02
Attach on object and handle all of trigger events depends on validation rules on layers and tags.
using UnityEngine;
using UnityEngine.Events;
using System.Collections;
/// <summary>
/// Attach on trigger and set validate rule. Invoke events if validation is successful.
/// </summary>
public class TriggerHanlder : MonoBehaviour {
public enum ValidateRule {
ANY, BOTH
@birdinforest
birdinforest / ApplySelectedPrefabs.cs
Last active August 8, 2022 20:10
Apply multiple prefabs at once. Select all your prefabs and use either shortcut or Tools menu item to apply and revert. (You can change shortcuts in the script if you want, currently it uses ctrl+shft+a to apply and ctrl+shft+r to revert)
// Credit: baptisteLar from http://forum.unity3d.com/threads/little-script-apply-and-revert-several-prefab-at-once.295311/
public class ApplySelectedPrefabs : EditorWindow
{
public delegate void ApplyOrRevert(GameObject _goCurrentGo, Object _ObjPrefabParent, ReplacePrefabOptions _eReplaceOptions);
[MenuItem ("Tools/Apply all selected prefabs %#a")]
static void ApplyPrefabs()
{
SearchPrefabConnections (ApplyToSelectedPrefabs);
}
@birdinforest
birdinforest / CollisionIgnore.cs
Last active July 19, 2016 01:48
Ignore collision if collider math given layer mask or collider's tag is in given tags list. NOTE: This is perminently ignoring in whole game runtime.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Ignore collision if collider math given layer mask or collider's tag is in given tags list.
/// NOTE: This is perminent ignoring in whole game runtime.
/// </summary>
public class CollisionIgnore : MonoBehaviour {
[SerializeField] private LayerMask ignoreMask;
@birdinforest
birdinforest / IEnumerableTest.cs
Last active June 7, 2016 00:30
Example of IEnumerable and IEnumerator. Show what 'yiled' statement dose.
using UnityEngine;
using System.Collections;
/// <summary>
/// Try to learn IEnumerable and IEnumerator.
/// Find out what 'yiled' statement dose. Ref: https://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx
/// </summary>
namespace Lab.IEnumerableTest {
public class Car
{