Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Markus Reinhardt markusrt

🏠
Working from home
  • WS Audiology
  • Erlangen, Germany
View GitHub Profile
View BookSnippet
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 Apr 25, 2014
Unity3D scripts published prior to Ludum Dare 29
View Credits.cs
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 Dec 25, 2015
This Gist demonstrates how to use NUnits Action Attributes in order to create and delete a temporary directory on test case level.
View ActionAttributeDemoTest.cs
[TestFixture]
public class ActionAttributeDemoTest : ITempDirectoryTest
{
public string TemporaryDirectoryToStoreTestData { get; set; }
[Test]
public void ITempDirectoryTest_ImplementsInterface_TemporaryDirectoryIsCreatedAutomatically()
{
Assert.That(Directory.Exists(TemporaryDirectoryToStoreTestData), Is.True);
}
View robot.js
//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 Sep 25, 2012
Unity animate OTAnimatedSprite based on movement speed
View gist:3784166
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 Sep 25, 2012
Unity: Detect collision above
View gist:3784133
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 Sep 25, 2012
Platformer Controller in Air controls
View gist:3784093
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 Sep 3, 2012
Unity Script: Fade Orthello sprite in or out
View FadeSprite.cs
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 Jul 24, 2012
Unity: Check if player stopped falling and position on ground
View Player.cs
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 Jan 11, 2012
Enables debugging for a specified executable. This causes a debugger [vsjitdebugger.exe] to be launched each time the program starts.
View debug.bat
@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=
You can’t perform that action at this time.