Skip to content

Instantly share code, notes, and snippets.

@judah4
judah4 / ShortenUrls.rs
Created May 26, 2023 16:18
Make a shorten and restore method to shorten a url and expand it, in Rust.
use std::collections::HashMap;
use rand::Rng;
/*
Make a shorten and restore method to shorten a url and expand it.
*/
const ALPHAS : &str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
struct ShortUrls {
@judah4
judah4 / DeploymentsController.cs
Created May 16, 2019 22:53
Example Deployments endpoint for SpatialOS game
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Net;
using System.Security.Claims;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Google.Protobuf.WellKnownTypes;
@judah4
judah4 / CharacterMovementBehavior.cs
Last active September 15, 2024 13:46
KineMovement implements the BaseCharacterController for Kine Character Controller. Follow how SetInput get the input and preps to apply it in the method UpdateVelocity for the CharcterController. This gets set in PlayerControlsVisualizer for the client side through the character visualizer. Same with the server and remote client behaviors in Cha…
using Improbable;
using UnityEngine;
using Improbable.Character;
using Improbable.Gdk.GameObjectRepresentation;
using Improbable.Gdk.TransformSynchronization;
using Improbable.Worker.CInterop;
public class CharacterMovementBehavior : MonoBehaviour {
[Require]
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
namespace Gnarlywood.Core.Sites
{
public static class ActionResultHelper
{
@judah4
judah4 / KineTransformClientReceiver.cs
Created March 1, 2019 18:15
Read Kinematic Controller position data and sync it with SpatialOS. In order to set the position in th receiver, it needs a reference to the Motor. I have a player check to not set the players position directly unless the movement watchdog decides the player needs to resync
using System.Collections;
using System.Collections.Generic;
using Improbable.Core;
using Improbable.CoreLibrary.Transforms.Local;
using Improbable.Gdk.GameObjectRepresentation;
using Improbable.Worker.CInterop;
using UnityEngine;
public class KineTransformClientReceiver : KineTransformReceiver
{