Skip to content

Instantly share code, notes, and snippets.

View AnikoV's full-sized avatar

Vladimir AnikoV

View GitHub Profile
public static bool SymmetricHysteresis( bool currentState, float input, float threshold, float hysteresis )
{
if( input > threshold + hysteresis )
{
return true;
}
if( input < threshold - hysteresis )
{
return false;
}
@AnikoV
AnikoV / Request
Last active August 29, 2015 14:18
async/await request for .NET with JSON.NET serialization
public static class Request
{
public const string Version = "1.0";
public const string Type = "request";
public const string BaseUrl = "yourBaseUrl";
public static async Task<T> DoPostRequestJsonAsync<T>(string udid, string cmd, object postData) where T : class, new()
{
var serializableObject = CreateRequestJson(udid, cmd, postData);
try