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 / TerrainStitcher.cs
Created June 16, 2018 19:31
Stitch terrain in unity
class TerrainStitcher extends EditorWindow {
public var terrain1: Terrain = null;
public var terrain2: Terrain = null;
public var options: String[] = ["X", "Z"];
public var index: int = 0;
@MenuItem ("Tools/Terrain stitcher")
static function ShowWindow () {
EditorWindow.GetWindow (TerrainStitcher);
}
@CreatureSurvive
CreatureSurvive / CSPVersionCell.h
Created July 23, 2018 14:53
Example of a custom PSTableCell
#import <Preferences/PSTableCell.h>
#import <Preferences/PSSpecifier.h>
@interface CSPVersionCell : PSTableCell
@end
@CreatureSurvive
CreatureSurvive / CSPValueCell.h
Last active July 26, 2018 18:45
Custom PSTableCell for displaying numerical values in a formatted manor, also implements a custom ToolBar for the inputAccessoryView
/**
* @Author: Dana Buehre <creaturesurvive>
* @Date: 11-09-2017 1:22:14
* @Email: dbuehre@me.com
* @Filename: CSPValueCell.h
* @Last modified by: creaturesurvive
* @Last modified time: 16-09-2017 10:45:22
* @Copyright: Copyright © 2014-2017 CreatureSurvive
*/
@CreatureSurvive
CreatureSurvive / CSPListController.h
Last active July 30, 2018 06:45
A simple PSListController Implementation that will display an alert notifying the user if their using a pirated copy of the tweak. Provides an action to add the official source for your tweak, and an action to continue using the pirated version. If the user chooses to continue with the pirated version, the support section of the preferences will…
@interface CSPListController : PSListController
@end
@CreatureSurvive
CreatureSurvive / OverrideImageInBundle.m
Created July 31, 2018 00:35
return a custom image based on the name of the requested image within a bundle. this should only be used when filtering a specific app in your bundle filter plist
%hook UIImage
// you should not include the file extention or scale in the file name for this to work
// I have not tested this, but it should work for any image being loaded from the bundle
// baseNameOfLaunchscreenImage@2x.png -> baseNameOfLaunchscreenImage
+ (UIImage *)imageNamed: (NSString *)name {
if ([name containsString:@"baseNameOfLaunchscreenImage"]) {
return [UIImage imageWithContentsOfFile:@"/User/Documents/CustomLaunchImage.png"];
}
@CreatureSurvive
CreatureSurvive / noctis_notifications.xm
Last active August 14, 2018 21:04
Am I insane, or should one of these methods be working with NoctisXI
- (void)applicationDidFinishLaunching: (UIApplication *)application {
%orig;
NSLog(@"registering for noctis notifications");
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
// with SEL callbacks
[center addObserver:self selector:@selector(__didRecieveNoctisNotification:) name:@"com.laughingquoll.noctis.enablenotification" object:nil];
[center addObserver:self selector:@selector(__didRecieveNoctisNotification:) name:@"com.laughingquoll.noctis.disablenotification" object:nil];
@CreatureSurvive
CreatureSurvive / UITextView.m
Created October 26, 2018 01:06 — forked from fethica/UITextView.m
Size-to-Fit Text in UITextView
#define kDefaultFontSize 24.0
myTextView.text = @"Some long string that will be in the UITextView";
myTextView.font = [UIFont systemFontOfSize:kDefaultFontSize];
//setup text resizing check here
if (myTextView.contentSize.height > myTextView.frame.size.height) {
int fontIncrement = 1;
while (myTextView.contentSize.height > myTextView.frame.size.height) {
myTextView.font = [UIFont systemFontOfSize:kDefaultFontSize-fontIncrement];
@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 {
@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 / 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