Skip to content

Instantly share code, notes, and snippets.

@beelsebob
beelsebob / gist:6201559
Last active December 20, 2015 21:59 — forked from seivan/gist:6201545
NSArray * playerIdentifiers = [matches SH_reduceValue:@[] withBlock:^id(NSArray *memo, GKTurnBasedMatch *obj) {
return [memo arrayByAddingObjectsFromArray:[obj SH_playerIdentifier]];
}];
// header
#import <CoreGraphics/CoreGraphics.h>
CG_INLINE CGRect CGRectMakeWithSize(CGSize size);
CG_INLINE CGRect CGRectMakeWithPointAndSize(CGPoint point, CGSize size);
CG_INLINE void CGRectMoveToY(CGRect rect, CGFloat y);
@beelsebob
beelsebob / First.h
Last active December 12, 2015 02:18
@interface JAHFirstViewController : UIViewController // Note, JAH class prefix, you should prefix all of your classes
@property (nonatomic, strong) NSMutableArray *json; /* this property is named poorly – it's not json, it's an array */
@end
// HomeTableViewController
- (IBAction)btnLogout:(id)sender {
self.animateBOOL = YES;
[Lockbox setString:@"FALSE" forKey:kLoggedinStatusKeyString];
[(TabBarViewController *)[self tabBarController] loginCheck:animateBOOL];
}
// TabBarViewController
@beelsebob
beelsebob / gist:4643576
Last active December 11, 2015 18:39 — forked from jhoughjr/gist:4643570
+(PHColorSchemeManager*) sharedInstance
{
static PHColorSchemeManager* theInstance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^()
{
theInstance = [[[self class] alloc] init];
});
@beelsebob
beelsebob / Stuff
Last active December 11, 2015 06:08 — forked from mikeash/gist:4557052
Doom:~ tatd2$ clang -framework Foundation -fobjc-arc Foo.m
Doom:~ tatd2$ gdb ./a.out
GNU gdb 6.3.50-20050815 (Apple version gdb-1820) (Sat Jun 16 02:40:11 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ..... done
@beelsebob
beelsebob / gist:4405689
Last active December 10, 2015 08:08 — forked from anonymous/gist:4405683
@property (copy) NSArray regions;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return (if tableView == self.searchDisplayController.searchResultsTableView
then [filteredResult count]
else [regions[section] count]);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Adding Cell");
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tokenSuggestCell"];
if (!cell) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MyTokenFieldCell" owner:self options:nil];
cell = (UITableViewCell *)[nib objectAtIndex:0];
@interface RootViewController : UITableViewController
@property (nonatomic, copy) NSArray *region;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
[self setTableView:[[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]];
[self setRegions:@[@[@"Bologna", @"Florence", @"Milan"]], @[@"Naples", @"Rome", @"Turin"]]];
[self setTitle:@"Region"];
}