Skip to content

Instantly share code, notes, and snippets.

[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.01]];
@mattyohe
mattyohe / gist:8319719
Created January 8, 2014 16:34
UILabel that sizes in portrait and landscape
@implementation MYLabel
- (void)layoutSubviews
{
self.preferredMaxLayoutWidth = self.frame.size.width;
[super layoutSubviews];
}
@end
@mattyohe
mattyohe / gist:7826904
Created December 6, 2013 15:47
NSDateFormatter fun!
NSTimeInterval time = 1388543400;
NSDateFormatter *formatter = [NSDateFormatter new];
[formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"EST"]];
[formatter setDateFormat:@"MMMM d, YYYY"];
NSLog(@"%@",[formatter stringFromDate:[NSDate dateWithTimeIntervalSince1970:time]]);
[formatter setDateFormat:@"MMMM d, yyyy"];
@mattyohe
mattyohe / gist:7105636
Created October 22, 2013 18:32
Superlatives used in Apple's keynote - 10/22/13
amazing
really excited
amazing
gorgeous & vibrant
blazing fast
stunning
bold
stunning
biggest & fastest
tremendous
@mattyohe
mattyohe / gist:7048943
Created October 18, 2013 22:05
Pass in argument for localization
-AppleLanguages (es)

Before you start

Make sure that you have the latest version of Xcode installed from the Mac App Store, and that you have the command line tools installed. To install the command line tools, open Xcode, click Xcode->Preferences->Downloads->Command Line Tools

Install brew if needed.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

Install ruby-build.

brew install ruby-build

@mattyohe
mattyohe / gist:6811214
Created October 3, 2013 14:57
Register bundle for settings.
- (void)registerBundleVersion
{
NSString *bundleVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
[[NSUserDefaults standardUserDefaults] setObject:bundleVersion
forKey:@"CFBundleVersion"];
}
@mattyohe
mattyohe / gist:6794815
Created October 2, 2013 14:40
codesign entitlement checking

Check entitlements on a binary

codesign -d --entitlements - AppBinary

Check signing information on binary

codesign -d -vv -r- AppBinary

@mattyohe
mattyohe / Gemfile
Last active December 22, 2015 20:09
source 'https://rubygems.org'
gem 'cocoapods', :git => 'http://github.com/CocoaPods/CocoaPods', :branch => 'xcode-5-support'
gem 'xcodeproj', :git => 'http://github.com/CocoaPods/Xcodeproj', :branch => 'redacted-support'
" Clear the search buffer when hitting return
function! MapCR()
nnoremap <cr> :nohlsearch<cr>
endfunction
call MapCR()