Skip to content

Instantly share code, notes, and snippets.

View florianbachmann's full-sized avatar
💭
rock n roll

Flori florianbachmann

💭
rock n roll
View GitHub Profile
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include
#define $(...) \
({ \
__weak __typeof__(self) weakSelf = self; \
\
^(__VA_ARGS__) { \
__strong __typeof__(weakSelf) self = weakSelf; \
$_body_
#define $_body_(...) \
__VA_ARGS__ \
@interface SomeViewController ()
// Declare some collection properties to hold the various updates we might get from the NSFetchedResultsControllerDelegate
@property (nonatomic, strong) NSMutableIndexSet *deletedSectionIndexes;
@property (nonatomic, strong) NSMutableIndexSet *insertedSectionIndexes;
@property (nonatomic, strong) NSMutableArray *deletedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *insertedRowIndexPaths;
@property (nonatomic, strong) NSMutableArray *updatedRowIndexPaths;
@end
@florianbachmann
florianbachmann / CCamera.m
Created December 1, 2012 12:59
Really simple Objective-C AVFoundation Camera class
//
// CCamera.h
// CCamera
//
// Created by Jonathan Wight on 7/12/12.
// Copyright (c) 2012 Jonathan Wight. All rights reserved.
//
#import <Foundation/Foundation.h>
input = ARGV[0]
episode = ARGV[1]
unless input and episode
puts 'Usage: convert.rb Episode003-master.mov 003'
exit
end
# Config
threads = 4
qmin = 10
@florianbachmann
florianbachmann / SNRRestorationManager.h
Created September 3, 2012 11:03 — forked from indragiek/SNRRestorationManager.h
Simple Cocoa state restoration
//
// SNRRestorationManager.h
// Sonora
//
// Created by Indragie Karunaratne on 2012-08-19.
//
#import <Foundation/Foundation.h>
@protocol SNRRestorableState <NSObject>
@florianbachmann
florianbachmann / UIView+FrameAdditions.h
Created August 22, 2012 16:21 — forked from nfarina/UIView+FrameAdditions.h
UIView Frame helper getter/setter category methods
#import <UIKit/UIKit.h>
@interface UIView (SMFrameAdditions)
@property (nonatomic, assign) CGPoint $origin;
@property (nonatomic, assign) CGSize $size;
@property (nonatomic, assign) CGFloat $x, $y, $width, $height; // normal rect properties
@property (nonatomic, assign) CGFloat $left, $top, $right, $bottom; // these will stretch the rect
@end
@florianbachmann
florianbachmann / SNRDiscogsEngine.h
Created August 20, 2012 06:36 — forked from indragiek/SNRDiscogsEngine.h
API wrapper for the Discogs API built on AFNetworking
//
// SNRDiscogsEngine.h
// Sonora
//
// Created by Indragie Karunaratne on 11-11-18.
//
#import <Foundation/Foundation.h>
@interface SNRDiscogsEngine : NSObject
@florianbachmann
florianbachmann / IPInsetLabel.h
Created July 14, 2012 08:10
IPInsetLabel: a simple UILabel subclass that adds padding insets and auto-height-resizing
//
// IPInsetLabel.h
// Instapaper
//
// Created by Marco Arment on 7/23/11.
// Copyright 2011 Instapaper LLC, released to the public domain.
//
#import <UIKit/UIKit.h>
#ifdef DEBUG
void pspdf_swizzle(Class c, SEL orig, SEL new) {
Method origMethod = class_getInstanceMethod(c, orig);
Method newMethod = class_getInstanceMethod(c, new);
if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod))) {
class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
}else {
method_exchangeImplementations(origMethod, newMethod);
}