This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find . -name '*.strings' -print | egrep -v 'Pods' | zip source -@ | |
# Break it down: | |
# | |
# Find all files with file name ending with .strings | |
# find . -name '*.strings' -print | |
# | |
# Search for all lines that don't have 'Pods' in it (the -v means invert) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BJMSearchBar.h | |
// | |
// Created by Vinayak Ram on 9/8/15. | |
// | |
#import <UIKit/UIKit.h> | |
@interface BJMSearchBar : UISearchBar |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the block that's passed in needs to return an object | |
#define DEFINE_SHARED_INSTANCE_USING_BLOCK(block) \ | |
static dispatch_once_t pred = 0; \ | |
__strong static id _sharedObject = nil; \ | |
dispatch_once(&pred, ^{ _sharedObject = block(); }); \ | |
return _sharedObject; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation EVCSomeClass | |
+(EVCSomeClass *)shared { | |
static EVCSomeClass *shared = nil; | |
// dispatch_once_t is typedef'd to a long | |
static dispatch_once_t pred; | |
// this block is executed synchronously, and only one time ever for the given predicate | |
dispatch_once(&pred, ^{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation EVCSomeClass | |
+(EVCSomeClass *)shared { | |
static EVCSomeClass *shared = nil; | |
// synchronizes by locking on the Class EVCSomeClass | |
@synchronized([EVCSomeClass class]) { | |
shared = [EVCSomeClass new]; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation EVCSomeClass | |
+(EVCSomeClass *)shared { | |
static EVCSomeClass *shared = nil; | |
if( !shared ) { | |
shared = [EVCSomeClass new]; | |
} | |
return shared; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
Language: Cpp | |
BasedOnStyle: WebKit | |
# AccessModifierOffset: -4 | |
# ConstructorInitializerIndentWidth: 4 | |
# AlignEscapedNewlinesLeft: false | |
# AlignTrailingComments: false | |
# AllowAllParametersOfDeclarationOnNextLine: true | |
# AllowShortBlocksOnASingleLine: false | |
# AllowShortCaseLabelsOnASingleLine: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void objc_setAssociatedObject ( id object, const void *key, id value, objc_AssociationPolicy policy ); | |
// object = usually 'self'. This is the object you want to associate a key and value with. | |
// key = the key you want to associate the object with | |
// value = the value you want to associate with the key | |
// objc_AssociationPolicy is one of the below: | |
enum { | |
OBJC_ASSOCIATION_ASSIGN = 0, | |
OBJC_ASSOCIATION_RETAIN_NONATOMIC = 1, |
NewerOlder