Skip to content

Instantly share code, notes, and snippets.

View star4z's full-sized avatar

Benjamin Phillips star4z

View GitHub Profile
window.addEventListener("error", (event) => {
const dataToSend: Record<string, string> = {
'entry.<>': event.timeStamp.toString(),
'entry.<>': event.message,
'entry.<>': event.filename,
'entry.<>': event.lineno.toString(),
'entry.<>': event.colno.toString(),
'entry.<>': event.error
};
fetch('https://docs.google.com/forms/d/e/<>/formResponse', {
@star4z
star4z / unavailableToBricklink.py
Last active March 31, 2025 00:53
Convert LEGO Pick-a-Brick unavailable pieces CSV to BrickLink Wanted List XML
AssetPostprocessor event function:
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets,
string[] movedFromAssetPaths, bool didDomainReload)
ObjectFactory.componentWasAdded
Undo.postprocessModifications
EditorApplication.delayCall
DidReloadScriptsAttribute
InitializeOnLoadAttribute
EditorSceneManager.activeSceneChangedInEditMode
@star4z
star4z / WaitForCoroutines.cs
Created December 20, 2022 06:01
Waiting for a bunch of Unity Coroutines to finish. It emits the items, 0, 100, 200, ..., 900, 1, 101, 201,...
public class WaitForCoroutines: MonoBehaviour
{
private void Start()
{
StartCoroutine(StartCoroutines());
}
private IEnumerator StartCoroutines()
{
return Enumerable.Range(0, 10).Select(i => StartCoroutine(Foo(i * 100))).ToList().GetEnumerator();
@star4z
star4z / CoroutineTestBehaviour.cs
Created December 18, 2022 16:40
Verify that yield return StartCoroutine and yield return IEnumerator both function as wait calls
public class CoroutineTestBehaviour: MonoBehaviour
{
private void Start()
{
StartCoroutine(Coroutine1());
}
private IEnumerator Coroutine1()
{
yield return StartCoroutine(Coroutine2());
@star4z
star4z / CharacterController2D.cs
Created October 21, 2021 03:30
Simple player movement
using UnityEngine;
public class CharacterController2D : MonoBehaviour
{
public float magnitude = 1;
private Rigidbody2D _rigidbody;
// Start is called before the first frame update
void Start()
@star4z
star4z / MRTK_README.md
Last active March 12, 2020 14:36
Guide to using MRTK, Unity, HoloLens

MRTK Guide

Setting up Unity 2019 project

Overview and software info

This guide goes through setting up a Unity 2019 project with Mixed Reality Toolkit (MRTK) and the new XR plugins to work with HoloLens 1. The guide was made specifically for the following software versions, and may or may not apply to other versions.

@star4z
star4z / django_setup.rst
Last active January 21, 2020 23:08
A brief guide/tutorial on how to set up a new basic django project
.. contents::
=========
Requirements
------------
- Python 3.7+
- Django 2.2+ [1]_
- database software (We use mariadb/mysql, but Django is configurable with pretty much any database software.
- mysqlclient [1]_
clc; clear; close all;
jointDensity = [
325 338 78
338 169 0
78 0 0]/1326;
x_j = 0:2;
y_i = 0:2;