Skip to content

Instantly share code, notes, and snippets.

View CreatureSurvive's full-sized avatar
:octocat:
melting an ancient GPU in Unity3d

Dana Buehre CreatureSurvive

:octocat:
melting an ancient GPU in Unity3d
View GitHub Profile
@CreatureSurvive
CreatureSurvive / iOS System Colors.md
Created March 21, 2022 21:51
iOS System Colors with their light and dark values

iOS System Colors

Background Colors

Color Name Light Color Dark Color
systemBackground #FFFFFFFF rgba(1.0, 1.0, 1.0, 1.0) #000000FF rgba(0.0, 0.0, 0.0, 1.0)
secondarySystemBackground #F2F2F7FF rgba(0.95, 0.95, 0.97, 1.0) #1C1C1EFF rgba(0.11, 0.11, 0.12, 1.0)
tertiarySystemBackground #F2F2F7FF rgba(0.95, 0.95, 0.97, 1.0) #1C1C1EFF rgba(0.11, 0.11, 0.12, 1.0)
tertiarySystemBackground #FFFFFFFF rgba(1.0, 1.0, 1.0, 1.0) #2C2C2EFF rgba(0.17, 0.17, 0.18, 1.0)
@CreatureSurvive
CreatureSurvive / UnityProjectJunctionTool.cs
Last active May 9, 2022 23:39
Unity editor tool to create dummy Unity projects to allow a single project to be open in multiple editor instances (Windows, Mac, Linux)
// NOTE:
// This is a modified version of https://gist.github.com/IronWarrior/005f649e443bf51b656729231d0b8af4
// This version adds support for Mac OS and Linux systems
//
// PURPOSE:
// Unity does not permit a project to be open in two different editor instances.
// This can be frustrating when building projects with multiplayer networking,
// as it would require you to create a build every time you wish you test your netcode.
// A workaround would be to duplicate the project, but this would require the duplicated
// project to be updated each time a change is made.
@CreatureSurvive
CreatureSurvive / HeaderAttribute.cs
Last active May 1, 2024 17:26
Better inspector headers in Unity
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
//using CS;
//[System.Serializable]
//public class HeaderExampleClass
//{
// [Header("My Fields", 3)]
@CreatureSurvive
CreatureSurvive / Viola_Preset
Created May 30, 2019 00:44
Viola Bubbles Preset
YnZ4MsERAAA0BoBWACYBMF6K3G2sfwIwxwAAAD9cwAN/wEVWNEYRogrMfXCwdhPjXLDXAKrN3j1ZB+Pk5PbkrEd3Z1c3Vwd7zmWVAQAAAAAA3J8c7IODg4PTo3lyeX02z6+adtgxamNH52y0jgPnOlpz7o6TdWDU9Ojq6GCf16FrHbQZd3PO7iQZnns+r66egHmwL+9O7g7O7w/8AY4fgIPRTo1lNtHWqGAFRZVEY4KqqqqoKgkgqgCiAFVRUFBRVFEBRRUxggAAABqiSYIFEcGvwBQf9UTRUAn1UqrQNOh85B6h/ka/zCnxdDgRpj3d05nEVE9lak3MNCGhCZoiqaz0TC3JSXOqEjEBx8vhASUiWt7mzuTfmA3qck7mvr98iOi7X8buigtahdARaIZL4QbzU4MaHIAQfCEQ6k3pzeVR5dHkUeTR4yhsFDXqQROoHsqDJvSNKoOSQPj/+7/8fn3fujfdl/akPWZv2Uv8nv/1FB70m1c9p4fsC31gXsSD5D88h5/3b8/6mk/Fy8Gr/4f/f99H3+/ez97H7l/vT+8v7wvv3/Zt91H7p/ubfc0+5r7lF+7v+kbf6pv9mXwdvv87//v++/w7+9383fud+Z34ftoP9/Wd5P6cPf/w83Do8Fm4JPwUTgEOFQwQ/P9s/6x+3k7JT/zTr0PQ0T+oH7YHYxiFaWF92KIw/8j3kdyRTKQHWQYpIi1CUoHEH0geqB1YGygJ3AMRBKKB/wAvAM3jpMfNcKFxcjgINxIOG5z8sPJh1sMAGGvYFqYCC8EUgs3A4ld9V0VXzapN1V/FrTJL9Y7K/hD5oetDzqHV0N2QQ6gvRE94Tvi/O99531XvdHeeOxRd1nXUs+n7U568qSfKXuDSBZ630IysTaHU7DNkjV9zXIxXiGsUlsjlFxR04BGK7ydr2L5hXWgQTzEcXdJ6oMLc9fXEpkryOnd04nDQM6lslTFTbBdZ02mGo6dGqz+IbCNNMTjv1unSGlEEmTZK6+jOZ83mmCvi5VpsaxUy
@CreatureSurvive
CreatureSurvive / FileLogging.h
Created May 19, 2019 02:23 — forked from DGh0st/FileLogging.h
Log to a custom file, can be used to get logs from users with a debug build.
#ifndef FILELOGGING
#define FILELOGGING
#ifndef DEBUG
#define FLOG(args...)
#else
#define kLOGFILEPATH @"/path/to/log/file.log"
void _FLog(const char *functionName, int lineNumber, NSString *msgFormat, ...) {
va_list ap;
@CreatureSurvive
CreatureSurvive / update_packages.sh
Created May 3, 2019 19:25
Example of using DPKG to generate a deb, and update a Packages file for a repository
#!/bin/bash
# if your on ios, run this as root
# cd to your repo directory first eg: `cd /path/to/my/repo/`
# your project folder is the folder containing your DEBIAN folder
#build debs
echo building
dpkg-deb -b /path/to/project/folder debs
@CreatureSurvive
CreatureSurvive / CSForceTouchGestureRecognizer.h
Created April 27, 2019 00:35
A UIGestureRecognizer subclass that handles Force Touch events.
//
// ForceTouchGestureRecognizer.h
// TouchFlow
//
// Created by Dana Buehre on 4/26/19.
// Copyright © 2019 CreatureCoding. All rights reserved.
//
#import <UIKit/UIKit.h>
@CreatureSurvive
CreatureSurvive / NSString+URLsFromString.h
Last active January 3, 2019 16:25
NSString category to get all URLs from a string Returns a NSArray of NSURLs `NSArray <NSURL *> *`
//
// NSString+URLsFromString.h
//
@interface NSString (URLsFromString)
+ (NSArray <NSURL*> *)URLsFromString:(NSString *)string;
- (NSArray <NSURL*> *)URLs;
@end
@CreatureSurvive
CreatureSurvive / ObjectForKeypath.m
Last active November 7, 2024 18:45
object from json keypath
/*
* usage:
* [self objectForKeypath:@"someKey.3.someNestedKey.2" inJSON:myJSONObject];
*/
- (id)objectForKeypath:(NSString *)keypath inJSON:(NSData *)json {
if (!keypath || !json) {return nil;}
__block NSInteger depth = 0;
NSArray *keys = [keypath componentsSeparatedByString:@"."];
id result = [NSJSONSerialization JSONObjectWithData:json options:kNilOptions error:nil];
@CreatureSurvive
CreatureSurvive / ScaleView.m
Last active October 29, 2018 21:46
A couple simple methods of scaling a UIView transform to fit inside another UIView.
/*
/ usage:
/ UIView * myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 375, 375)];
/ UIView * myContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 60, 60)];
/ CGFloat scale = [self scaleForSize:myView.bounds.size fitToSize:myContainer.bounds.size];
/ myView.transform = CGAffineTransformScale(CGAffineTransformIdentity, scale, scale);
/ [myContainer addSubview:myView];
*/
- (CGFloat)scaleForSize:(CGSize)source fitToSize:(CGSize)destination {