Skip to content

Instantly share code, notes, and snippets.

View desmondfernando's full-sized avatar

Desmond Fernando desmondfernando

View GitHub Profile
# By default the ssh-agent service is disabled. Allow it to be manually started for the next step to work.
# Make sure you're running as an Administrator.
Get-Service ssh-agent | Set-Service -StartupType Manual
# Start the service
Start-Service ssh-agent
# This should return a status of Running
Get-Service ssh-agent
@desmondfernando
desmondfernando / DisableHWStats.cs
Last active December 3, 2021 08:46
Code snippet to disable HW statistics reporting. NOTE only works in the Editor not for runtime! Unity Pro only
var type = Type.GetType( "UnityEditor.PlayerSettings,UnityEditor" );
if ( type != null )
{
var propertyInfo = type.GetProperty( "submitAnalytics", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static );
if ( propertyInfo != null )
{
{
var value = (bool)propertyInfo.GetValue( null, null );
Debug.LogFormat( "PlayerSettings.submitAnalytics {0}", value );
}
@desmondfernando
desmondfernando / GetAuthorizationTokenUsingMasterKey.cs
Last active August 29, 2015 14:25
Access Microsoft Azure DocumentDB from Unity
/// <summary>
///
/// </summary>
/// <param name="verb"></param>
/// <param name="resourceId"></param>
/// <param name="resourceType"></param>
/// <param name="date"></param>
/// <param name="masterKey"></param>
/// <returns></returns>
private string GetAuthorizationTokenUsingMasterKey( string verb, string resourceId, string resourceType, string date, string masterKey )
@desmondfernando
desmondfernando / gist:5f2187c52a79a3433f0b
Created February 25, 2015 18:00
CI Snippet to set scripting backend in Unity to build for 64-bit iOS support
#if UNITY_5
PlayerSettings.SetPropertyInt( "ScriptingBackend", (int)ScriptingImplementation.IL2CPP, BuildTargetGroup.iOS );
#else
PlayerSettings.SetPropertyInt( "ScriptingBackend", (int)ScriptingImplementation.IL2CPP, BuildTargetGroup.iPhone );
#endif
@desmondfernando
desmondfernando / builtinButton
Last active August 29, 2015 14:14
Snippet to create basic Unity UI button from script, using built in resources
// create new button...
var o = new GameObject( id, typeof( Image ), typeof( Button ) );
o.transform.SetParent( parent );
var image = o.GetComponent<Image>();
image.sprite =
AssetDatabase.LoadAllAssetsAtPath( "Resources/unity_builtin_extra" ).OfType<Sprite>().SingleOrDefault(
sprite => sprite.name.Equals( "UISprite", StringComparison.OrdinalIgnoreCase ) );
image.type = Image.Type.Sliced;