Skip to content

Instantly share code, notes, and snippets.

@jasoncg
jasoncg / webrtc_example.js
Created August 13, 2019 23:04
A minimal WebRTC DataChannel example
/**
* A minimal example of a WebRTC data channel on a single host.
* After running, use dcRemote.send('message') or dcLocal.send('message') to send messages between local and remote peers
**/
let peerLocal = new RTCPeerConnection();
let peerRemote = new RTCPeerConnection();
peerLocal.onconnectionstatechange = function(e) {
console.log('peerLocal', 'onconnectionstatechange', e);
@jasoncg
jasoncg / MonoSingleton.cs
Last active January 27, 2019 00:02
MonoSingleton.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace LiquidPools {
/// use
/// public class NewClass : MonoSingleton<NewClass> { }
//based on https://github.com/Brackeys/Portal-In-Unity/blob/master/Portal/Assets/ScreenCutoutShader.shader
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
Shader "Unlit/BasicScreenCutoutShader"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_EyeDistance("Eye Distance", Float) = 0
}
@jasoncg
jasoncg / VoxelandHierarchyView.cs
Last active October 24, 2018 11:30
Voxeland build progress in Unity Hierarchy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine;
using Voxeland5;
/// <summary>