Skip to content

Instantly share code, notes, and snippets.

@techanon
techanon / a_filename_parse.regex
Last active August 29, 2015 14:15
A very long and convoluted regex to dissect a properly named file for music.
(?P<originalartist>.+?) -(?: (?P<albumname>(?:(?! - ).)+) -(?: (?<tracknumber>(?:[0-9][0-9])))?)? (?P<songtitle>(?P<songname>(?:(?! \(ft\.).)+) ?(?:\(ft\. (?P<originalfeaturing>(?:[^)]+?(?:(?=\))|, ))+)\))?(?: \((?:(?P<productionartist>(?:(?!\1 ).+)?) )?(?P<songtype>(?:Remix|VIP|Cover|Version|Instrumental|Parody|Mashup))(?: ft\. (?P<additionalfeaturing>(?:[^)]+?(?:(?=\))|, ))+))?\))?)
<!DOCTYPE html>
<html>
<head>
<style>
/* demo purpose only */
body {display:flex; }
/** CSS **/
.blurbox {
--size: 500px;
@techanon
techanon / temp_proxy_proto_example.js
Created November 17, 2017 02:35
Proxy protocol on the fly.
class T {
constructor(){
this.value = 'test';
}
test() {
return this.value + '-amend';
}
wrap() {
return proxy(this.test).bind(this);
}
@techanon
techanon / quickzip.js
Created May 10, 2018 15:41
snippets for quickly zipping either multiple arrays or multiple strings.
// Licence: Public domain
function zipArray(...params) {
for (let i in params)
if (!Array.isArray(params[i]))
throw new Error(`All parameters to be zipped MUST be an array. Parameter ${i} is not.`);
let out = [], count = Math.max(...params.map(i=>i.length));
for (let i = 0; i < count; i++) {
for (let param of params) {
if (i < param.length) out.push(param[i]);
function getElementsByXpath(path, context) {
if (!context) context = document;
let res = document.evaluate(path, context, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
let tmp, out = [];
while (tmp = res.iterateNext())
out.push(tmp);
return out;
}
@techanon
techanon / start_avd.bat
Created March 31, 2019 06:04
Android Emulator boot cmd script
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
SET count=0
FOR /F "tokens=* USEBACKQ" %%F IN (`%ANDROID_HOME%\emulator\emulator.exe -list-avds`) DO (
SET /a count=!count!+1
SET var!count!=%%F
)
for /l %%i in (1,1,%count%) do echo %%i) !var%%i!
@echo digit number of virtual machine to run or 'q' to quit
set /p choice=""
@techanon
techanon / emoji.txt
Last active August 18, 2020 18:55
List of text based emoji cause screw the animated ones.
ᕕ( ᐛ )ᕗ
ᕙ( ᐖ )ᕓ
( ͡° ͜ʖ ͡°)
( ‾ʖ̫‾)
¯\_(ツ)_/¯
(ノಠ益ಠ)ノ彡┻━┻
ᕦ(ò_óˇ)ᕤ
ヽ༼ຈل͜ຈ༽ノ
ಠ_ಠ
ಥ‿ಥ
@techanon
techanon / 1_PickupAsInteract.cs
Last active October 27, 2020 21:26
Sample concept of using OnPickup inplace of Interact in order to detect the used hand.
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
[RequireComponent(typeof(VRC_Pickup))]
public class PickupAsInteract : UdonSharpBehaviour
{
[Tooltip("Receives events: OnInteractLeft, OnInteractRight")]
@techanon
techanon / GetMyComponents.cs
Last active January 13, 2021 01:56
Type-agnostic transform depth-search algorithm for any component within Udon, just change 'MyComponent' the type you are looking for.
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
using VRC.Udon;
public class GetMyComponents : UdonSharpBehaviour
{
public GameObject[] roots;
[HideInInspector] public MyComponent[] comps;