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
@danielmartin
danielmartin / BetterXcodeJumpToCounterpartSwift.org
Last active March 9, 2024 02:00
Add support for a better Xcode's Jump to Next Counterpart in Swift

If you work on a Swift project that follows the Model-View-ViewModel (MVVM) architecture or similar, you may want to jump to counterpart in Xcode from your view to your model, and then to your view model. (ie. by using Ctrl+Cmd+Up and Ctrl+Cmd+Down).

You can do this in recent versions of Xcode by setting a configuration default.

From a terminal, just type this command and press Enter:

defaults write com.apple.dt.Xcode IDEAdditionalCounterpartSuffixes -array-add "ViewModel" "View"
@DGh0st
DGh0st / SBLockscreenDateViewController(iOS 10).mm
Last active August 25, 2019 06:40
SBLockscreenDateViewController implementation for iOS 10 (generated using a disassembler)
@interface SBLockScreenDateViewController : UIViewController <SBDateTimeOverrideObserver, _UISettingsKeyObserver> {
NSNumber* _timerToken;
BOOL _disablesUpdates;
_UILegibilitySettings* _legibilitySettings;
}
@property (assign,getter=isSubtitleHidden,nonatomic) BOOL subtitleHidden;
@property (nonatomic,retain) _UILegibilitySettings * legibilitySettings;
@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
@JohnCoates
JohnCoates / AutoHook.h
Created May 26, 2017 22:06
Simple Objective-C Method Hooking
@protocol AutoHook <NSObject>
@required
+ (NSArray <NSString *> *)targetClasses;
@end
@Nosskirneh
Nosskirneh / README.md
Last active July 1, 2020 00:47 — forked from kirb/.htaccess
Self-hosted Cydia Repo Download Counter

How to Add a Download Counter to A Self-Hosted Cydia Repo

This is a fork of kirb's repo download counter, only that this one works and that one doesn't.

Installation

  1. Click the download link at the top of the gist page to save these files to your machine.
  2. Unzip them and open counter.php and nginx.conf in your favorite non-Notepad text editor.
  3. In counter.php, scroll down to the line that says $db = mysqli_connect( ... and change the parameters to the ones you use to connect to MySQL.
  4. If your database doesn't use the UTF-8 charset, change the UTF8 in the if (!mysqli_set_charset($db, "UTF8")) ... line to the appropriate value.
  5. Go down to the if (!mysqli_select_db($db, "myrepodb")) ... line and change myrepodb to the name of your database.
  6. Run the downloads.sql file i
@luciditee
luciditee / BatchBurner.cs
Last active June 16, 2018 17:09
Batch Burner, a script designed to reduce static mesh draw calls in Unity scenes with a large number of static mesh entities.
/*
* Unity Batch Burner: A script designed to reduce static mesh draw calls automatically in scenes
* with a large amount of static geometry entities.
*
* Copyright 2016-2017 Will Preston & Die-Cast Magic Studios, LLC.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@ozouai
ozouai / HTMLtoAttributedString.m
Last active June 24, 2017 03:48
Turns HTML into an attributed string with a custom font and paragraph spacing
// Omar Zouai | https://omarzouai.com/
- (NSMutableAttributedString*)htmlToAttributed:(NSString*)html font:(UIFont*)font paragraphSpacing:(CGFloat)pSpacing {
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithData:[html dataUsingEncoding:NSUTF8StringEncoding] options:@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType, NSCharacterEncodingDocumentAttribute:@(NSUTF8StringEncoding)} documentAttributes:nil error:nil];
[string beginEditing];
NSMutableParagraphStyle *pStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
[pStyle setParagraphSpacing:pSpacing];
[string enumerateAttributesInRange:NSMakeRange(0, string.length) options:nil usingBlock:^(NSDictionary *attrs, NSRange range, BOOL *stop) {
UIFont *theFont = [attrs objectForKey:@"NSFont"];
@mrhether
mrhether / UILabel+HTML.m
Created February 24, 2016 19:38
UILabel + HTML
#import "UILabel+HTML.h"
@implementation UILabel (HTML)
- (void) setHtml: (NSString*) html
{
// Add font from label
NSString* finalHtml = [html stringByAppendingString:[NSString stringWithFormat:@"<style>body{font-family: '%@'; font-size:%fpx;}</style>",
self.font.fontName,
self.font.pointSize]];
- (UIViewController *)previewingContext:(id<UIViewControllerPreviewing>)previewingContext
viewControllerForLocation:(CGPoint)location
{
// query the collectionView for index corresponting to the touch location
NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:location];
// just in case
if (!indexPath) { return nil; }
// get the data object corresponding to the pressed cell
@andrassomogyi
andrassomogyi / AViewController.h
Created September 25, 2015 09:43
SFSafariViewController Objective-C example
#import <UIKit/UIKit.h>
@import SafariServices;
@interface AViewController : UIViewController
//
// ...
//
@end