Skip to content

Instantly share code, notes, and snippets.

@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]);
}
@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: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];
});
// HomeTableViewController
- (IBAction)btnLogout:(id)sender {
self.animateBOOL = YES;
[Lockbox setString:@"FALSE" forKey:kLoggedinStatusKeyString];
[(TabBarViewController *)[self tabBarController] loginCheck:animateBOOL];
}
// TabBarViewController
@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
// 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 / 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]];
}];
@beelsebob
beelsebob / gist:6201641
Last active December 20, 2015 21:59 — forked from seivan/gist:6201583
NSMutableArray *playerIds = [[NSMutableArray alloc] init];
for (GKTurnBasedMatch *match in theMatches)
{
[playerIds addObjectsFromArray:[match playerIdentifiers]];
}
[playerIds addObjectsFromArray:friends];
/*
Example.m
Created by Remy "Psy" Demarest on 21/04/2012.
Copyright (c) 2012. Remy "Psy" Demarest
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@beelsebob
beelsebob / MyQuiz.m
Last active December 21, 2015 06:19 — forked from pbrewczynski/MyQuiz.h
... All of foundation's headers ...
@interface MyQuiz : NSObject
@property (nonatomic, strong) NSMutableArray *quoteArray;
-(id) initWithTheQuiz : (NSString *) plistName;
@end
@implementation MyQuiz
-(id) initWithTheQuiz:(NSString *)plistName {
self = [super init];
if(self) {