Skip to content

Instantly share code, notes, and snippets.

View chivalry's full-sized avatar
👨‍💻
Converting coffee into software.

Charles Ross chivalry

👨‍💻
Converting coffee into software.
  • Chivalry Software
  • San Jacinto, CA
View GitHub Profile
~ $ cd Scripts/
Scripts $ mkdir Python
Scripts $ git clone https://github.com/xolox/vim-tools.git
Cloning into 'vim-tools'...
remote: Reusing existing pack: 373, done.
remote: Total 373 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (373/373), 120.88 KiB | 34 KiB/s, done.
Resolving deltas: 100% (213/213), done.
- (NSString *)camelCaseToTitleCase {
NSMutableString *string = [NSMutableString string];
NSCharacterSet *upper = [NSCharacterSet uppercaseLetterCharacterSet];
for (NSInteger index = 0; index < [self length]; index++) {
NSString *character = [self substringWithRange:NSMakeRange(index, 1)];
if ([character rangeOfCharacterFromSet:upper].location != NSNotFound) {
[string appendString:@" "];
}
[string appendString:character];
- (NSString *)titleCaseToCamelCase {
NSString *string = [self capitalizedString];
string = [string stringByReplacingOccurrencesOfString:@" " withString:@""];
string = [NSString stringWithFormat:@"%@", string];
return [string stringByReplacingCharactersInRange:NSMakeRange(0, 1)
withString:[[string substringToIndex:1]
lowercaseString]];
}
.h
extern NSString *const MyFirstConstant;
.m
NSString *const MyFirstConstant = @"FirstConstant";
+ (NSString *)entityName {
return NSStringFromClass(self);
}
+ (AbstractEntity *)insertNewObjectInManagedObjectContext:(NSManagedObjectContext *)moc {
return [NSEntityDescription insertNewObjectForEntityForName:[self entityName]
inManagedObjectContext:moc];
}
:%s/¶/" ,\r "/g
" Replace every occurrence of the paragraph character with a quote, comma, carriage return, four spaces and a quote.
/usr/libexec/PlistBuddy /Applications/SpamSieve.app/Contents/Info.plist -c "Set LSUIElement 1"
codesign -f -s - /Applications/SpamSieve.app
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
# command for using mogenerator to generate core data classes.
# should be executed from the same directory as the data model is found
mogenerator --model DataModel.xcdatamodeld --output-dir mogenerated --template-var arc=true --includeh XXXDataModel.h
#ifdef DEBUG
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#define OLog(arg) NSLog(@"%s %@", __PRETTY_FUNCTION__, arg)
#else
#define DLog(...) do { } while (0)
#define OLog(arg) do { } while (0)
#ifndef NS_BLOCK_ASSERTIONS