This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Extensions.DependencyInjection; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using Xunit.Sdk; | |
namespace Example.Testing | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MathWishlist { | |
// Mathf | |
public const float TAU = 6.28318530717959f; | |
public static float Frac( float x ) => x - Mathf.Floor( x ); | |
public static float Smooth01(float x) => x * x * (3 - 2 * x); | |
public static float InverseLerpUnclamped( float a, float b, float value) => (value - a) / (b - a); | |
public static float Remap(float iMin, float iMax, float oMin, float oMax, float value) { | |
float t = Mathf.InverseLerp(iMin, iMax, value); | |
return Mathf.Lerp( oMin, oMax, t ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Unity specific .gitattributes | |
* text=auto | |
*.cs diff=csharp text | |
*.cginc text | |
*.shader text | |
# Unity YAML | |
*.anim -text merge=unityyamlmerge diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* text=auto | |
# Unity files | |
*.meta -text -merge=unityamlmerge | |
*.unity -text -merge=unityamlmerge | |
*.asset -text -merge=unityamlmerge | |
*.prefab -text -merge=unityamlmerge | |
# Image formats | |
*.psd filter=lfs diff=lfs merge=lfs -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Web; | |
using System.Web.Mvc; | |
using System.Web.Optimization; | |
using System.Web.Routing; | |
using Microsoft.Extensions.DependencyInjection; | |
using WebApplication16; | |
using WebApplication16.Controllers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Concurrent; | |
using System.Diagnostics; | |
using System.Threading; | |
using System.Threading.Tasks; | |
/// <summary> | |
/// Used to control the rate of some occurrence per unit of time. | |
/// </summary> | |
/// <remarks> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomRequireHttpsFilter : RequireHttpsAttribute | |
{ | |
protected override void HandleNonHttpsRequest(AuthorizationContext filterContext) | |
{ | |
// The base only redirects GET, but we added HEAD as well. This avoids exceptions for bots crawling using HEAD. | |
// The other requests will throw an exception to ensure the correct verbs are used. | |
// We fall back to the base method as the mvc exceptions are marked as internal. | |
if (!String.Equals(filterContext.HttpContext.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase) | |
&& !String.Equals(filterContext.HttpContext.Request.HttpMethod, "HEAD", StringComparison.OrdinalIgnoreCase)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Data.SqlClient; | |
using System.Reflection; | |
namespace HorribleThingsInHere | |
{ | |
/// <summary> | |
/// Workaround completely test-unfriendly sql error classes. | |
/// Copy-paste from http://stackoverflow.com/a/1387030/10245 | |
/// Adjusted with updates in comments | |
/// Adjusted to not use ctor indexes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using MonoTouch.UIKit; | |
public sealed class UIViewAnimations : IDisposable | |
{ | |
public UIViewAnimations(bool enabled) | |
{ | |
_wasEnabled = UIView.AnimationsEnabled; | |
UIView.AnimationsEnabled = enabled; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using MonoTouch.Foundation; | |
using MonoTouch.ObjCRuntime; | |
using MonoTouch.UIKit; | |
namespace iOSLib | |
{ | |
public static class ViewExtensions | |
{ | |
public static String ViewDisposed = "ViewExtension_ViewDisposed"; |
NewerOlder