Skip to content

Instantly share code, notes, and snippets.

@akbyrd
akbyrd / profile-build.ps1
Created October 16, 2023 18:15
Quick 'n' Dirty Build Profiling
$user = [Security.Principal.WindowsIdentity]::GetCurrent();
$isAdmin = (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
if (-Not $isAdmin)
{
Start-Process pwsh -Wait -Verb RunAs -ArgumentList "-Command $PSCommandPath $args; pause"
return
}
$fileName = $args
if ($fileName)
@akbyrd
akbyrd / 0 - Resource Creation.cpp
Created July 30, 2020 19:31
DirectX 11 Swap Chain Format Support
DXGI_FORMAT renderTextureFormat = DXGI_FORMAT_B5G6R5_UNORM;
// Device
hr = D3D11CreateDevice(
nullptr,
D3D_DRIVER_TYPE_HARDWARE,
nullptr,
D3D11_CREATE_DEVICE_SINGLETHREADED | D3D11_CREATE_DEVICE_DEBUG,
// Goal: Add type safety and compile time checks to sprintf.
//
// * Use % as a placeholder for any type, without requiring a type parameter such as %f or %s
// * Ensure the number of % placeholders matches the number of parameters at compile time
// * Use strcpy where possible, instead of building the string character by character
// * Don't do multiple passes over the format to count % placeholders ahead of time
// * Not currently worried about custom format specifiers like %.2f (will expand later to allow e.g. {0.2})
// Grammer
// % is a placeholder for a value
@akbyrd
akbyrd / cloudSettings
Last active June 20, 2024 21:08
Visual Studio Code Settings Sync Gist
{"lastUpload":"2024-06-20T21:08:41.666Z","extensionVersion":"v3.4.3"}
@akbyrd
akbyrd / PDCollection.cs
Last active July 29, 2017 21:41
An in-progress collection drawer for Unity. Enum specialization is prototype stage, feel free to ignore.
namespace PixelDash.Tools.Editor.Presentation
{
using System;
using PixelDash.Tools.Presentation;
using UnityEditor;
using UnityEngine;
using UnityEngine.Assertions;
using UObject = UnityEngine.Object;
using Flags = PixelDash.Tools.Presentation.PDCollectionFlags;