Skip to content

Instantly share code, notes, and snippets.

View julenka's full-sized avatar

Julia Schwarz julenka

View GitHub Profile
@julenka
julenka / CloneOnGrab.cs
Last active September 8, 2019 20:27
MRTK Example of how to clone an object when you grab it, move the clone around, and then release the clone when you release your hand. Tested with the MRTK 2.0 release, at https://github.com/Microsoft/MixedRealityToolkit-Unity/releases/tag/v2.0.0
using Microsoft.MixedReality.Toolkit;
using Microsoft.MixedReality.Toolkit.Input;
using UnityEngine;
/// <summary>
/// Creates a clone of this game object when the item is grabbed using near interaction
/// </summary>
public class CloneOnGrab : MonoBehaviour
{
private void Start()
@julenka
julenka / UnityTouchController.cs
Last active July 25, 2019 06:21
Code change to get World-Space Unity UI working on MRTK with mobile phones
// Refer to lines 22, 131, 168 and the Update() Method.
// Many thanks to @newske who posted a partial solution on stackoverflow:
// https://stackoverflow.com/questions/56846672/how-can-i-configure-mrtk-to-work-with-touch-input-in-editor-and-on-mobile-device?noredirect=1#comment100693647_56846672
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Ensures that the position of this object relative to ObjectToFollow
/// remains the same, in the frame of reference of their first common ancestor
/// </summary>
public class MatchPosition : MonoBehaviour
@julenka
julenka / get-elapsedprevious.ps1
Created May 24, 2017 18:06
Print how long previous commands took
# Examples:
# Get-ElapsedPrevious
# Get-ElapsedPrevious 5
function Get-ElapsedPrevious($n=1)
{
    Get-History -Count $n | % { 
        $output = "{0} ({1} seconds)" -f $_.CommandLine, ($_.EndExecutionTime - $_.StartExecutionTime).TotalSeconds
        Write-Host $output }
}
@julenka
julenka / log.h
Created April 14, 2016 18:18
Windows win32 log.h
#pragma once
#ifndef LOG_LEVEL
#define LOG_LEVEL 4 // 0 = nothing, 5 = verbose
#endif
#include <stdio.h>
#define _NOP do{}while(0)
@julenka
julenka / UnityPause.cs
Created April 13, 2016 23:03
Pattern for pausing stuff in Unity. Handy for debugging things or understanding how algorithms work.
private void Awake () {
StartCoroutine(Generate());
}
private IEnumerator Generate () {
WaitForSeconds wait = new WaitForSeconds(0.05f);
yield return wait;
}
@julenka
julenka / MakeShortcut.vbs
Created December 4, 2015 01:33
MakeShortcut
if Wscript.Arguments.Count = 0 then
Wscript.Echo "Usage: make-shortcut.vbs shortcutName shortcutWorkingDir shortcutPath shortcutArgs..."
Wscript.Quit
end if
Dim shortcutName
Dim shortcutPath
Dim shortcutWorkingDir
Dim shortcutArgs
shortcutName = Wscript.Arguments(0)
@julenka
julenka / it_is_not_an_image.txt
Last active November 22, 2015 02:03
It is not an image
0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,5.90659462491,5.11010646917,15.1383964388,46.4439719166,65.6996352717,92.0826135994,129.238576706,132.754602471,116.059569164,130.819523085,148.794375928,139.826428456,103.280910681,78.8457360134,58.3896637186,39.6551277396,22.3439999208,16.7573143782,1.76483130219,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.
@julenka
julenka / QuickWindows.ahk
Created October 29, 2015 22:39
Use Hotkeys to quickly activate windows. Handy with lots of monitors!
; Use ctrl + shift + 5 to select outlook
^+5::
SetTitleMatchMode 2
WinActivate Outlook
Return
; Use ctrl + shift + 5 to select sublime
^+6::
SetTitleMatchMode 2
WinActivate Sublime
@julenka
julenka / designmode.cs
Created September 30, 2015 15:44
Design Mode #c# #winuniversal
if (!DesignMode.DesignModeEnabled)
{
...
}