Skip to content

Instantly share code, notes, and snippets.

View championofblocks's full-sized avatar
💭
I may be slow to respond.

Niall Kelly championofblocks

💭
I may be slow to respond.
View GitHub Profile
@championofblocks
championofblocks / gist:9683519
Created March 21, 2014 10:38
iOS System Version Checks
#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
@championofblocks
championofblocks / Markdown Example
Created January 28, 2014 12:47
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 November 25, 2013 23:15
Set delay on dock to 1000 seconds to effectively disable it
defaults write com.apple.Dock autohide-delay -float 1000 && killall Dock
@championofblocks
championofblocks / gist:5362517
Created April 11, 2013 11:06
Shared folder permissions
sudo chmod -R og+w <shared-folder-name>
@championofblocks
championofblocks / gist:5256281
Created March 27, 2013 17:25
UIFont dynamic loading from external resource
+ (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 August 15, 2024 11:17
Command line bash to convert all wav to mp3
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done