Skip to content

Instantly share code, notes, and snippets.

View florieger's full-sized avatar

Florian Rieger florieger

View GitHub Profile
@florieger
florieger / ACAppDelegate-iOS
Last active August 27, 2020 09:21
Swift AppDelegate without Storyboard / XIB for iOS.
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.backgroundColor = UIColor.black
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
@florieger
florieger / ACViewController.swift
Last active March 12, 2019 09:09
Swift ViewController without Storyboard / XIB.
class ACViewController: UIViewController {
let frame: CGRect
let childViewController: UIViewController
var imageView: UIImageView?
// MARK: Init
init(frame: CGRect) {
self.frame = frame
@indyfromoz
indyfromoz / gist:7033012
Created October 17, 2013 22:02
Prevent Xcode from updating
On the versions you don’t wish to auto-update, remove Xcode.app/Contents/_MASReceipt/receipt
@jacobbubu
jacobbubu / ioslocaleidentifiers.csv
Created February 15, 2012 14:41
iOS Locale Identifiers
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@florieger
florieger / ACSingleton.m
Created October 21, 2011 11:32
Cocoa Singleton implementation
#import "ACSingleton.h"
@implementation ACSingleton
#pragma mark -
#pragma mark Singleton Pattern
static ACSingleton* _sharedInstance;
static dispatch_once_t _instanceFlag;
@steipete
steipete / UIImage+PSPDFKitAdditions.m
Created August 13, 2011 20:52
Preload UIImage for super-smooth interaction. especially great if you use JPGs, which otherwise produce a noticeable lag on the main thread.
- (UIImage *)pspdf_preloadedImage {
CGImageRef image = self.CGImage;
// make a bitmap context of a suitable size to draw to, forcing decode
size_t width = CGImageGetWidth(image);
size_t height = CGImageGetHeight(image);
CGColorSpaceRef colourSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef imageContext = CGBitmapContextCreate(NULL, width, height, 8, width*4, colourSpace,
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little);