Skip to content

Instantly share code, notes, and snippets.

@championofblocks
championofblocks / gist:9683519
Created Mar 21, 2014
iOS System Version Checks
View gist:9683519
#if TARGET_OS_IPHONE
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
#endif
View Markdown Example
An h1 header
============
Paragraphs are separated by a blank line.
2nd paragraph. *Italic*, **bold**, `monospace`. Itemized lists
look like:
* this one
* that one
@championofblocks
championofblocks / Hide Dock
Created Nov 25, 2013
Set delay on dock to 1000 seconds to effectively disable it
View Hide Dock
defaults write com.apple.Dock autohide-delay -float 1000 && killall Dock
@championofblocks
championofblocks / gist:5362517
Created Apr 11, 2013
Shared folder permissions
View gist:5362517
sudo chmod -R og+w <shared-folder-name>
@championofblocks
championofblocks / gist:5256281
Created Mar 27, 2013
UIFont dynamic loading from external resource
View gist:5256281
+ (void)loadFontAtPath:(NSString*)path{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:path]];
if(data == nil){
NSLog(@"Failed to load font. Data at path is null");
return;
}
CFErrorRef error;
CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data);
@championofblocks
championofblocks / wav-mp3
Last active Dec 31, 2020
Command line bash to convert all wav to mp3
View wav-mp3
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done