Skip to content

Instantly share code, notes, and snippets.

@jesterswilde
jesterswilde / raymarch.hlsl
Created October 7, 2025 20:22
Raymarcher
#pragma kernel CSMain
Texture2D<float4> Source;
RWTexture2D<float4> Destination;
float4x4 _CameraToWorld;
float4x4 _CameraInverseProjection;
float3 _Light;
bool positionLight;
@jesterswilde
jesterswilde / controls.cs
Created August 27, 2025 06:55
Unity Controls Helper
using System;
using UnityEngine;
[Flags]
public enum DPad : byte
{
None = 0,
Up = 1 << 0,
Down = 1 << 1,
Left = 1 << 2,
@jesterswilde
jesterswilde / migration.ts
Created February 27, 2025 16:14
Migration
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url'
import { pool } from '../db/db.js';
import { sql } from '../util.js'
import { PoolClient } from 'pg';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@jesterswilde
jesterswilde / instruction.cs
Created February 27, 2025 16:13
Raymarcher
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using Sirenix.OdinInspector;
namespace Instructions
{
[ExecuteInEditMode]
public abstract class Instruction : MonoBehaviour {
[SerializeField, ReadOnly]
function speak(text) {
const utterance = new SpeechSynthesisUtterance(text);
speechSynthesis.speak(utterance);
}
const letters = ["A", "B", "C", "D","E", "F", "G", "H", "J", "K", "L","M","N","O","P","Q","R","S", "T"]
socket.onAny((message,data)=>{
var isMove = message.split('/')[2] === "move"
var color = (data.move_number % 2) == 0 ? "White to " : "Black to "
if(isMove){
const quickSort = (array, left = 0, right)=>{
if(right === undefined){
right = array.length -1;
}
if(left >= right){
return;
}
moveMedian(array, left, right);
let wall = left;
const pivot = right;
/*
I made a handful of decisions about this function:
1) I know you said array of integers, but I decided to make it a bit more resiliant.
2) If you give me a non-array, I will just spit that back at you
3) This is a functional thing, so I will return a new array instead of flattening in place
4) I did use newer language features, my assumption is that this will run in an environment where that is ok, or it will be transpiled
5) Flatten is strictly about arrays, so I don't do anything with objects.
*/
const flatten = (toFlattenArr) => {
export const listenForPlayerAction = (game: Game): Promise<ActionValue> => {
return new Promise((res, rej) => {
const { sockets, currentPlayerIndex } = game;
const currentSocket = sockets[currentPlayerIndex];
currentSocket.once('action', async (action: ActionTypes, value: number) => {
if (!checkIfValidAction(game, action, value)) {
rej("Invalid Action");
} else {
res({ action, value });
@jesterswilde
jesterswilde / Card.tsx
Created January 26, 2019 10:18
Card Display
interface Props {
card: Card
}
export default (props: Props)=>{
const { name, optional, requirements, effects } = props.card;
return <div class='game-card text-center'>
<div class='title'>{name}</div>
public class GameManager : MonoBehaviour
{
[SerializeField]
Player playerPrefab;
Timeline timeline;
static GameManager t;
List<ITimed> timedThings = new List<ITimed>();
IInput currentInput;