Skip to content

Instantly share code, notes, and snippets.

View markusrt's full-sized avatar
🏠
Working from home

Markus Reinhardt markusrt

🏠
Working from home
  • Broadcom
  • Germany
  • 12:26 (UTC +01:00)
  • LinkedIn in/markusrt
View GitHub Profile
The difference between the request with a JWT token and the request without, is that the former was validated by the Request Authentication filter and gets the claims stored in its connection filter metadata, meanwhile the latter lacks those.
@markusrt
markusrt / Credits.cs
Created April 25, 2014 23:14
Unity3D scripts published prior to Ludum Dare 29
using UnityEngine;
using System.Collections;
/// <summary>
/// Published prior to Ludum Dare 29
///
/// Simple Unity3D script to create scrolling credits
///
/// How to use:
///
@markusrt
markusrt / ActionAttributeDemoTest.cs
Last active December 25, 2015 20:49
This Gist demonstrates how to use NUnits Action Attributes in order to create and delete a temporary directory on test case level.
[TestFixture]
public class ActionAttributeDemoTest : ITempDirectoryTest
{
public string TemporaryDirectoryToStoreTestData { get; set; }
[Test]
public void ITempDirectoryTest_ImplementsInterface_TemporaryDirectoryIsCreatedAutomatically()
{
Assert.That(Directory.Exists(TemporaryDirectoryToStoreTestData), Is.True);
}
@markusrt
markusrt / robot.js
Created December 5, 2012 22:37
TOBOR I
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(10);
robot.rotateCannon(10);
@markusrt
markusrt / gist:3784166
Created September 25, 2012 20:15
Unity animate OTAnimatedSprite based on movement speed
if(
// NEW instead of movement.isMoving
movement.speed>movement.walkSpeed/10
&& !"runRight".Equals(sprite._animFrameset))
{
sprite.PlayLoop("runRight");
// NEW adapt playback speed based on movement speed
sprite.speed = movement.speed/movement.walkSpeed;
@markusrt
markusrt / gist:3784133
Created September 25, 2012 20:09
Unity: Detect collision above
var collisionAbove = ((controller.collisionFlags & CollisionFlags.Above) != 0);
if(collisionAbove)
{
if(movement.verticalSpeed>0)
{
movement.verticalSpeed = -1 * movement.verticalSpeed/-2.0;
}
}
@markusrt
markusrt / gist:3784093
Created September 25, 2012 19:59
Platformer Controller in Air controls
var absoluteAirVelocity = Mathf.Abs(movement.inAirVelocity.x);
if (absoluteAirVelocity < movement.inAirMinSpeed)
{
movement.inAirVelocity = Vector3(Mathf.Sign(h), 0, 0)
* movement.inAirMinSpeed;
}
else if (absoluteAirVelocity > movement.inAirMaxSpeed)
{
movement.inAirVelocity = Vector3(Mathf.Sign(h), 0, 0)
* movement.inAirMaxSpeed;
@markusrt
markusrt / FadeSprite.cs
Created September 3, 2012 22:04
Unity Script: Fade Orthello sprite in or out
using UnityEngine;
using System.Collections;
public class FadeSprite : MonoBehaviour {
public enum FadeDirection { FadeOut, FadeIn }
public FadeDirection Direction = FadeDirection.FadeOut;
public float Speed = 0.0f;
@markusrt
markusrt / Player.cs
Created July 24, 2012 19:51
Unity: Check if player stopped falling and position on ground
if ( Physics.Raycast(
new Vector3(
thisTransform.position.x-0.3f,
thisTransform.position.y,
thisTransform.position.z+1f),
-Vector3.up, out hit, 0.7f, groundMask) ||
Physics.Raycast(
new Vector3(
thisTransform.position.x+0.3f,
thisTransform.position.y,
@markusrt
markusrt / debug.bat
Created January 11, 2012 11:58
Enables debugging for a specified executable. This causes a debugger [vsjitdebugger.exe] to be launched each time the program starts.
@echo off
setlocal
REM Config section, change if required
set REG=C:\Windows\System32\reg.exe
set DEBUGGER=vsjitdebugger.exe
REM Config section end
set method=enable
set debugExe=