Skip to content

Instantly share code, notes, and snippets.

View matthewholliday's full-sized avatar

Matthew Holliday matthewholliday

  • Liveops
  • Phoenix, Arizona
View GitHub Profile
@matthewholliday
matthewholliday / FusionSpawner.cs
Created June 25, 2022 20:56
INetworkRunnerCallbacks empty implementation
using Fusion;
using Fusion.Sockets;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FusionSpawner : MonoBehaviour, INetworkRunnerCallbacks
{
public void OnPlayerJoined(NetworkRunner runner, PlayerRef player) { }
@matthewholliday
matthewholliday / NormalShader.shader
Last active June 5, 2022 23:29
Unity Normal Shader Template
Shader "MatthewShaders/NormalShader"
{
Properties
{
//Setting the default color to be green:
_MainTint ("Diffuse Tint", Color) = (0,1,0,1)
//"bump map" is a synonym for normal map- we are telling Unity that this will contain normal data:
_NormalTex ("Normal Map", 2D) = "bump" {}
@matthewholliday
matthewholliday / SimpleDiffuse.shader
Created June 5, 2022 22:41
Unity Diffuse Shader Template
Shader "MatthewShaders/StandardDiffuse"
{
Properties
{
//Defining a property that will be used to set the Albedo for this material.
_Color ("Color", Color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque" }
@matthewholliday
matthewholliday / HelloWorldUnityShader.shader
Last active June 4, 2022 16:41
Simple shader that outputs the color red.
Shader "Hello World Shader"
{
Properties
{
_Value("Value",Float) = 1.0 //Defines a custom float property called "Value"
}
SubShader
{
Tags { "RenderType"="Opaque" }
@matthewholliday
matthewholliday / .gitignore
Created May 29, 2022 02:17
Unity .gitignore
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/
/[Mm]emoryCaptures/
/[Rr]ecordings/
/[Aa]ssets/Plugins/Editor/JetBrains*
@matthewholliday
matthewholliday / JumpController.cs
Created May 14, 2022 20:27
Player controller for jumping in Unity XR (should be attached to XR Origin.)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class JumpController : MonoBehaviour
{
[SerializeField] private InputActionReference jumpActionReference;
[SerializeField] private float jumpForce = 500.0f;
@matthewholliday
matthewholliday / ssh2-interactive-shell-example.js
Created November 25, 2021 20:53
Creating interactive shell session with ssh2 example.
const { readFileSync } = require('fs');
const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
console.log('CONNECTED! \n\n');
conn.shell((err, stream) => {
if (err) throw err;
@matthewholliday
matthewholliday / ssh2_connection_example.js
Last active November 25, 2021 20:32
Connecting to SSH server with ssh2 example
const { readFileSync } = require('fs');
const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
console.log('CONNECTED! \n\n');
//Run the "ls -la" command.
@matthewholliday
matthewholliday / fetch_data_promise.js
Created November 20, 2021 03:47
Fetch data from API using promises in react
const [testData,setTestData] = useState({message : "abc"});
useEffect(() => {
async function setData(){
fetch('http://localhost:8080/test').then(
response => { response.json(); }
).then(
response => { setTestData(response); }
);
@matthewholliday
matthewholliday / fetch_data_await_async.js
Created November 20, 2021 03:43
Use fetch with await/async in react
const [testData,setTestData] = useState({message : "abc"});
useEffect(() => {
async function setData(){
const response = await fetch('http://localhost:8080/test');
const parsedData = await response.json();
setTestData(parsedData);
setData();
},[]);