Skip to content

Instantly share code, notes, and snippets.

View ssshake's full-sized avatar

Richard Bettridge ssshake

View GitHub Profile
@ssshake
ssshake / NPCDialog.cs
Last active March 4, 2024 17:39
Unity NPC Dialog with Branching Nodes and Unlimited Statements and Responses
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
namespace Daggasoft {
[System.Serializable]
public class Statement {
# Position relative to HMD
OVRCameraRig rig;
rig = FindObjectOfType<OVRCameraRig>();
transform.position = rig.transform.TransformPoint(menuOffset);
Vector3 newEulerRot = rig.transform.rotation.eulerAngles;
newEulerRot.x = 0.0f;
newEulerRot.z = 0.0f;
transform.eulerAngles = newEulerRot;
//Adding this here because I couldn't figure out how to tell my grabble items in a game world when it's been grabbed
//so that it could do something on grab or release. Such as play a sound effect.
//
//After a lot of document searching I was surprised that I couldn't find what I was looking for.
//
//This extends OVRGrabble from the Oculus Unity SDK.
//You override methods called on grab
//You do your custom work
//You then pass the attributes on to OVRGrabble because it still needs these to do its own piece of work
//So, it's a pain in the ass to use scrollTo within an iframe because
//the parent document and the document in the iframe have no context of each other.
//
//The problem can be hard to imagine if you haven't directly ran into it before, but lets assume you have
//a parent document that is a couple thousand pixels high. It spans off the screen.
//In that document you have an iframe somewhere near the top (or wherever)
//Under some condition you want to scroll to the top (or anywhere) of the iframe
//But lets say in the parent document you a scrolled all the way to the bottom so the iframe isn't in view at all
//When you issue window.scrollTo(0,0), the iframe itself will scroll to the top, but the parent document wont do anything.
//Why would it? It has no context.
@ssshake
ssshake / isWrit
Last active September 29, 2023 06:15
Photon PUN Cheat Sheet
## Photon Methods
**public class Blank : Photon.PunBehaviour**
instead of mono behavior, use this to receive photon callbacks in your script.
**public override void OnLeftRoom()**
An example of overriding a punbehavior callback
@ssshake
ssshake / YouveGotMail.ino
Last active December 24, 2017 03:01
Youve Got Mail - Home Mailbox Notifier using ESP12E
/**
* YouveGotMail.ino
* Check your home mailbox for new mail and notify some service
* Created by https://github.com/ssshake
*
*/
#include <Arduino.h>
#include <ESP8266WiFi.h>
;Install autohotkey https://www.autohotkey.com/download/
;put this in your startup folder
;enjoy
;maps common osx keys.
;ctrl + z,x,c,v,a,s,y are all accessible via winkey + z,x,c,v,a,s,y
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
@ssshake
ssshake / screeshot-resize-for-app-store.sh
Created November 1, 2017 18:21
Take in screenshots and resize them to meet the requirements for iphone and ipad dimensions in the app store
mkdir iphone
mkdir ipad
cp *.jpg iphone/
cp *.jpg ipad/
sips -z 2208 1242 iphone/*.jpg
sips -z 2732 2048 ipad/*.jpg
const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');
const logger = require('morgan');
const multipart = require('connect-multiparty');
const fs = require('fs');
const shortid = require('shortid');
let app = express();
/**
* Transcribed from Persistence - Saving and Loading Data Tutorial video.
* Original code by Mike Geig.
* Transcribed by rocky1138.
* No idea on what the license is. I think it's fairly safe to assume public domain
* since it's part of a tutorial video.
* https://unity3d.com/learn/tutorials/topics/scripting/persistence-saving-and-loading-data
*/
using UnityEngine;
using System.Collections;