Skip to content

Instantly share code, notes, and snippets.

@codingstyle
codingstyle / Unity-VR-XR-Migration.cs
Created September 13, 2017 07:06
Migration helper from VR to XR namespace in Unity 2017.2
//
// See : https://docs.google.com/document/d/1PCqlBTPToO908mkeOTRGFlFk1HXY_N1zYsNJtaZdUQA/preview
//
#if UNITY_2017_2
using UnityEngine.XR;
#else
using UnityEngine.VR;
using XRDevice = UnityEngine.VR.VRDevice;
using XRStats = UnityEngine.VR.VRStats;
using XRSettings = UnityEngine.VR.VRSettings;
@codingstyle
codingstyle / PlayerOutput.m
Created January 24, 2017 07:53
AVPlayer output
AVPlayerItemVideoOutput *videoOutput = [[AVPlayerItemVideoOutput alloc] initWithPixelBufferAttributes:pixelBufferAttributes];
videoOutput.suppressesPlayerRendering = YES;
// Do this action once your player item is ready
AVPlayerItem *currentItem = self.player.currentItem;
[currentItem addOutput:videoOutput];
@codingstyle
codingstyle / MTLBlitCommandEncoder.m
Created January 24, 2017 07:49
Metal texture copy and mipmap generation
id<MTLBlitCommandEncoder> blit = [currentCommandBuffer blitCommandEncoder];
[blit copyFromTexture:internalTexture sourceSlice:0 sourceLevel:0 sourceOrigin:MTLOriginMake(0, 0, 0) sourceSize:region.size toTexture:externalTexture destinationSlice:0 destinationLevel:0 destinationOrigin:MTLOriginMake(0, 0, 0)];
[blit generateMipmapsForTexture:externalTexture];
[blit endEncoding];
@codingstyle
codingstyle / gist:ecd443706ee2187ed226
Created January 29, 2015 16:40
"Autobots, rollout!"
curl -s "http://www.moviesoundclips.net/download.php?id=2091&ft=mp3" > /tmp/x.mp3 && afplay /tmp/x.mp3 && rm /tmp/x.mp3
@codingstyle
codingstyle / .bashrc
Created February 24, 2012 08:56
Colorful command line on MacOS X
#
# Dont forget to call ~/.bashrc in your ~/.profile script
#
export CLICOLOR=1
alias ll='ls -l'
alias la='ls -A'
alias vi='vim'
alias l='ls -CF'