Skip to content

Instantly share code, notes, and snippets.

View HyroVitalyProtago's full-sized avatar
💭
🦾 🧠

HyroVitalyProtago

💭
🦾 🧠
View GitHub Profile
@HyroVitalyProtago
HyroVitalyProtago / transform.js
Created January 3, 2023 10:30
D3 transform helper to translate and scale more easily
// inspired by https://github.com/d3/d3-zoom/blob/main/src/transform.js
class Transform() {
static identity = new Transform(0,0,1)
// https://stackoverflow.com/questions/70890280/d3-js-how-to-get-value-of-transform-attr
static fromSelection(selection) {
const translation = selection.node().transform.baseVal.getItem(0).matrix
const scale = selection.node().transform.baseVal.getItem(1).matrix
return new Transform(translation.e, translation.f, scale.a, scale.d)
}
@HyroVitalyProtago
HyroVitalyProtago / MyoUnityRawEmg
Created September 21, 2021 16:44 — forked from chrisjz/ MyoUnityRawEmg
EMG Raw Data access for Myo Unity package in SDK for Windows version 0.8.0
Patch for Myo Unity package for SDK Windows 0.8.0 to access EMG raw data.
@HyroVitalyProtago
HyroVitalyProtago / PluginUpdateCheck.cs
Created March 18, 2019 14:54
Check for new releases of repositories on GitHub.
// PluginUpdateCheck.cs
// Check for new releases of repositories on GitHub.
// By Adrienne Lombardo (@charblar)
using System;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEditor;
@HyroVitalyProtago
HyroVitalyProtago / LowPassFilter.cs
Created January 23, 2019 10:44
LowPassFilter for unity in c#
using UnityEngine;
/// <summary>
/// TODO generic-like?
/// -Warning- use Time.deltaTime
/// </summary>
public class LowPassFilter {
readonly float _rc;
float _lastValue;
public float Value { get; private set; }
@HyroVitalyProtago
HyroVitalyProtago / outline-geometry-component.js
Created February 1, 2018 15:43 — forked from cwervo/outline-geometry-component.js
A < 20 line (Hack-ish) A-Frame Outline Geometry component
AFRAME.registerComponent('outline-geometry', {
schema : {
margin : { default : 1.025 },
color: { default : 'red' },
},
init : function () {
var p = this.el;
var p_prime = p.cloneNode(true);
p_prime.removeAttribute('outline-geometry')
p_prime.setAttribute('material', 'color', this.data.color)
@HyroVitalyProtago
HyroVitalyProtago / Peer.js
Created November 10, 2017 16:35
Peer.js as https library for codepen
/*! peerjs build:0.3.13, development. Copyright(c) 2013 Michelle Bu <michelle@michellebu.com> */(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports.RTCSessionDescription = window.RTCSessionDescription ||
window.mozRTCSessionDescription;
module.exports.RTCPeerConnection = window.RTCPeerConnection ||
window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
module.exports.RTCIceCandidate = window.RTCIceCandidate ||
window.mozRTCIceCandidate;
},{}],2:[function(require,module,exports){
var util = require('./util');
using UnityEngine;
public class NestedPrefab : MonoBehaviour
{
#if UNITY_EDITOR
[SerializeField]
protected GameObject prefabTarget;
[ContextMenu("Apply nested Prefab")]
public virtual void ApplyNestedPrefab()
@HyroVitalyProtago
HyroVitalyProtago / README.txt
Last active January 23, 2017 10:13
Mindmap based on json, see the generated d3.js graph here : http://codepen.io/hyro/pen/VPPowX?editors=0110
# = ref
- = note
( = explored
> = todo
? = unknown
TODO
------------
"adhérence":{},
"acceptabilité":{},
@HyroVitalyProtago
HyroVitalyProtago / GvrControllerWifiConfig.cs
Created July 22, 2016 20:52
Unity GoogleVR (Daydream) script to change the emulator wifi config ip without change the original file
using System.Reflection;
using Gvr.Internal;
using UnityEngine;
public class GvrControllerWifiConfig : MonoBehaviour {
public string IP = "192.168.43.1";
void Awake() {
typeof(EmulatorConfig)
.GetField("WIFI_SERVER_IP", BindingFlags.Static | BindingFlags.Public)
@HyroVitalyProtago
HyroVitalyProtago / AlwaysLookAt.cs
Created April 22, 2016 14:15
Generic script to always look at a transform
using UnityEngine;
public class AlwaysLookAt : MonoBehaviour {
[SerializeField] Transform _transformToLookAt;
void Update() {
Vector3 v = _transformToLookAt.position - transform.position;
v.x = v.z = 0.0f;
transform.LookAt(_transformToLookAt.position - v);
transform.Rotate(0,180,0);
}