Skip to content

Instantly share code, notes, and snippets.

View grgcombs's full-sized avatar

Greg Combs grgcombs

View GitHub Profile
@grgcombs
grgcombs / gist:1250824
Created September 29, 2011 14:24
RKTableViewSections from @jeffarena
// This would be inserted somewhere in your app-wide tableviewcontroller superclass configuration, to reap the benefits across all subsequent tables.
self.tableController.heightForHeaderInSection = 22;
self.tableController.onViewForHeaderInSection = ^UIView*(NSUInteger sectionIndex, NSString* sectionTitle) {
UIView* headerView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.bounds.size.width, 22)] autorelease];
headerView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"sectionheader_bg.png"]];
UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(5, 0, self.tableView.bounds.size.width, 22)];
label.text = sectionTitle;
label.textColor = [UIColor whiteColor];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:12];
@grgcombs
grgcombs / OpenStatesApiExamples.json
Created September 7, 2011 07:37
Open States API examples
/** Open States API - Data for all state legislatures (well, 38 states so far)
* API documentation, method listing, and example GISTs at:
* http://openstates.sunlightlabs.com/api/
*
* Base URL = http://openstates.sunlightlabs.com/api/v1
* NOTE: All GET requests to this base URL must include an 'apikey' query parameter.
*
* My API key looks like this "/districts/tx?apikey=350284d0c6af453b9b56f6c1c7fea1f9"
*
* Resource Path Examples:
@grgcombs
grgcombs / SLFDataModels.h
Created September 7, 2011 05:56
Core Data Models for Open States API
@interface SLFLegislator : NSManagedObject
@property (nonatomic, retain) NSString * legID; // primary key
@property (nonatomic, retain) NSSet *positions; // to-many SLFCommitteePositions
@property (nonatomic, retain) NSString * suffixes;
@property (nonatomic, retain) NSString * party;
@property (nonatomic, retain) NSString * district;
@property (nonatomic, retain) NSNumber * active;
@property (nonatomic, retain) NSString * country;
@property (nonatomic, retain) NSString * stateID;