Skip to content

Instantly share code, notes, and snippets.

View leviathan's full-sized avatar

Jörg Polakowski leviathan

  • Lund, Sweden
  • 03:43 (UTC +02:00)
View GitHub Profile
@leviathan
leviathan / Load UIView with nib
Created January 7, 2011 14:53
Loading a custom UIView class with a custom nib file.
QPickOneView* myView = nil;
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"QPickOneView" owner:self options:nil];
for (id currentObject in nibViews) {
if ([currentObject isKindOfClass:[QPickOneView class]]) {
myView = (QPickOneView *) currentObject;
break;
}
}
@leviathan
leviathan / NSNotificationCenter+MainThread.h
Created November 6, 2010 16:40
A category to send NSNotifications in the UI thread
// NSNotificationCenter+MainThread.h
@interface NSNotificationCenter (MainThread)
- (void)postNotificationOnMainThread:(NSNotification *)notification;
- (void)postNotificationOnMainThreadName:(NSString *)aName object:(id)anObject;
- (void)postNotificationOnMainThreadName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo;
@end
@leviathan
leviathan / heroku dyno_worker setup
Created September 14, 2010 17:34
heroku dyno & worker setup from within the rails app
require "heroku"
client = Heroku::Client.new("username", "password")
# Update the number of dynos used by the application
# app_name = the name of the application
# x = the integer number of dynos you want to set, e.g. 3
client.set_dynos("app_name", x)
# Update the number of workers used by the application