Skip to content

Instantly share code, notes, and snippets.

@McNull
McNull / arraypool.ts
Last active January 4, 2024 10:48
three.js utils
export class ArrayPool<T> {
private _array: T[];
private _length: number;
private _capacity: number;
private _factory: () => T;
constructor(initialCapacity: number = 10, factory: () => T) {
this._array = new Array<T>(initialCapacity);
this._length = 0;
this._capacity = initialCapacity;
@McNull
McNull / proton.sh
Created October 14, 2023 20:38 — forked from chez14/proton.sh
Proton script to run non-Steam Apps on Linux. Supposedly you have to install Steam first (requires Steam account). Then put this to `/usr/bin/proton.sh` and add required file permissions.
#!/bin/bash
# Credits: https://pastebin.com/NJxfe8Ex
PROTON_VERSION="5.0"
PROTON_DIR=$HOME/.steam/steam/steamapps/common/Proton\ $PROTON_VERSION
RUNNING="$1"
if [ ! -f "$PROTON_DIR/proton" ] ; then
echo "Proton version $PROTON_VERSION not found!";
@McNull
McNull / extension.js
Created February 11, 2023 11:05
Disable inlay hints and color picker WebGL GLSL editor
This file has been truncated, but you can view the full file.
/*
Hack to disable color picker and inlay hints.
~/.vscode/extensions/raczzalan.webgl-glsl-editor-1.3.3-darwin-arm64/dist/extension.js
*/
/*! For license information please see extension.js.LICENSE.txt */
(() => {
"use strict";
var e = {
1466: (e, t) => {
@McNull
McNull / material_to_vertexcolor.py
Created March 20, 2022 10:19
Blender: assign a unique vertex color for each material to the mesh (id map)
import bpy
import random
import colorsys
import math
RANDOM_COLORMAP = False
VERTEX_COLOR_LAYERNAME = "_IDMAP_"
NO_MATERIAL_COLOR = (0,0,0,1)
@McNull
McNull / bitinn.py
Created September 12, 2018 16:08 — forked from bitinn/bitinn.py
Blender keymap for busy Maya / Unity / Substance Designer users
# version: 1.0.1
# latest source: https://gist.github.com/bitinn/22f6fefe026d8d9e83468864edb8f835
import bpy
import os
def kmi_props_setattr(kmi_props, attr, value):
try:
setattr(kmi_props, attr, value)
@McNull
McNull / KeepSceneViewActive.cs
Created August 7, 2018 13:52
Unity component that keeps the editor scene view active when entering play mode.
using UnityEngine;
/// <summary>
/// Keeps the editor scene view active when entering play mode.
/// Place this component on any game object.
/// </summary>
public class KeepSceneViewActive : MonoBehaviour
{
[Tooltip("Keep the editor scene view active")]
public bool KeepActive = true;
@McNull
McNull / unity-preset.py
Created October 21, 2016 04:37
Unity 3d key bindings for Blender
import bpy
import os
def kmi_props_setattr(kmi_props, attr, value):
try:
setattr(kmi_props, attr, value)
except AttributeError:
print("Warning: property '%s' not found in keymap item '%s'" %
(attr, kmi_props.__class__.__name__))
except Exception as e:
@McNull
McNull / app.html
Created September 21, 2016 19:05 — forked from haiau79/app.html
Aurelia RequireJS Gist
<template>
<object type="image/svg+xml" id="svgId"
data="e-3.svg" height="50" width="50" viewBox="0 0 50 50"
mouseover.delegate="domouseover()" mouseout.delegate="domouseout()"
click.delegate="doClickSVG()">
</object>
<div>
<img src="e-3.svg" click.delegate="doClickSVG()"/>
@McNull
McNull / gulpfile.js
Created September 19, 2016 08:04 — forked from grifdail/gulpfile.js
Simple babel livereload
var gulp = require('gulp'),
babel = require('gulp-babel'),
livereload = require('gulp-livereload'),
http = require('http'),
st = require('st'),
transform = require('vinyl-transform'),
browserify = require('browserify');
gulp.task('js', ["es6"],function() {
@McNull
McNull / index.html
Created September 14, 2016 07:35 — forked from anonymous/index.html
SVG ring 4
<div class="container" ng-app="app">
<div ng-controller="MyCtrl as vm">
<svg width="400" viewbox="-300 -300 600 600">
<g id="circle" style="transform: rotate({{vm.circleRotate}}deg)" ng-class="{ dragging: vm.dragStart }">
<circle fill="#F1F1F1" cy="0" cx="0" ng-attr-r="{{ ::vm.circleRadius }}"></circle>
<g ng-repeat="icon in vm.icons" class="icon" ng-attr-transform="{{ 'rotate(-' + vm.iconRotate * $index + ') translate(0, ' + (vm.circleRadius - vm.iconSize) + ')' }}">
<rect ng-attr-width="{{ ::vm.iconSize }}"
ng-attr-height="{{ ::vm.iconSize }}"
ng-attr-fill="{{ icon.color }}"
ng-attr-x="{{ ::-(vm.iconSize/2) }}"