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
@eoghain
eoghain / UICollectionViewFlowLayout+NoFade.m
Created March 5, 2014 00:16
When adding/removing/reloading cells in a UICollectionView using the FlowLayout the cells fade in/out. When doing things like updating a progress bar you get a lot of annoying flashing because of this, this category will prevent that. As an added benefit rotation animations will now show the cells moving into position.
//
// UICollectionViewFlowLayout+NoFade.m
//
// Created by Rob Booth on 3/4/14.
#import "UICollectionViewFlowLayout+NoFade.h"
#import <objc/runtime.h>
@implementation UICollectionViewFlowLayout (NoFade)
@kishikawakatsumi
kishikawakatsumi / gist:be87a6bf6992f815aa18
Created March 31, 2015 09:08
Register custom download font
#import "ViewController.h"
@import CoreText;
@interface ViewController ()
@end
@implementation ViewController
@saiday
saiday / gist:e8ea1a5165ca469baee4
Created July 14, 2015 07:59
Update UICollectionView with animation
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.collectionView performBatchUpdates:^{
[self.collectionView setCollectionViewLayout:self.collectionView.collectionViewLayout animated:YES];
} completion:nil];
}];
}
@andrassomogyi
andrassomogyi / AViewController.h
Created September 25, 2015 09:43
SFSafariViewController Objective-C example
#import <UIKit/UIKit.h>
@import SafariServices;
@interface AViewController : UIViewController
//
// ...
//
@end
- (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
@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]];
@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"];
@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
*
@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
@JohnCoates
JohnCoates / AutoHook.h
Created May 26, 2017 22:06
Simple Objective-C Method Hooking
@protocol AutoHook <NSObject>
@required
+ (NSArray <NSString *> *)targetClasses;
@end