Skip to content

Instantly share code, notes, and snippets.

View grgcombs's full-sized avatar

Greg Combs grgcombs

View GitHub Profile
@stepchud
stepchud / gist:2241056
Created March 29, 2012 18:01 — forked from phillipkoebbe/gist:1457544
Installing ruby-debug19 on ruby 1.9.3-p0 on Mac OS X Lion 10.7.2 with Xcode 4.2.1
# assumes 1.9.3-p0 is already installed in RVM (1.9.2) and you are in an empty gemset
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
gem install rake
gem install archive-tar-minitar
gem install ruby_core_source
gem install columnize
gem install linecache19-0.5.13.gem -- --with-ruby-include="$rvm_path/src/`rvm tools strings`"
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include="$rvm_path/src/`rvm tools strings`"
@grgcombs
grgcombs / NSPropertyDescriptionTransientBlock.m
Last active October 2, 2015 09:28
My Feature Request for NSPropertyDescription (Bug Reporter #11130505)
/*
Enhancement Request for Core Data
Apple Radar Issue #11130505
http://openradar.appspot.com/radar?id=3173403
I'd like to see an expansion of the Core Data framework that allows us to add a
transient property's underlying code via a block assigned on an
NSPropertyDescription, in order to provide an easy means to use transient properties
without subclassing the managed object.
@grgcombs
grgcombs / RKFetchedControllerSpecAddition.m
Created January 11, 2012 18:08
Reproducing a mysterious exception in RKFetchedResultsTableController (sections + empty item)
- (void)itShouldLoadFromNetworkUpdatingFromEmptyToFullWithSections {
[self bootstrapEmptyStoreAndCache];
[self stubObjectManagerToOnline];
UITableView* tableView = [UITableView new];
RKFetchedResultsTableControllerSpecViewController* viewController = [RKFetchedResultsTableControllerSpecViewController new];
RKFetchedResultsTableController* tableController =
[[RKFetchedResultsTableController alloc] initWithTableView:tableView viewController:viewController];
tableController.resourcePath = @"/JSON/humans/all.json";
tableController.sectionNameKeyPath = @"name";
@steipete
steipete / gist:1501754
Created December 20, 2011 14:34
Use Xcode to automatically set git hash
git=`sh /etc/profile; which git`
version=`$git describe --tags --always`
count=`$git rev-list --all |wc -l`
echo -e "#define GIT_VERSION $version\n#define GIT_COMMIT_COUNT $count" > InfoPlist.h
@steipete
steipete / DrawInsetBeveledRoundedRect.m
Created December 17, 2011 10:00
DrawInsetBeveledRoundedRect
void DrawInsetBeveledRoundedRect( CGContextRef context, CGRect rect, CGFloat radius, UIColor *fillColor )
{
//contract the bounds of the rectangle in to account for the stroke
CGRect drawRect = CGRectInset(rect, 1.0f, 1.0f);
//contract the height by 1 to account for the white bevel at the bottom
drawRect.size.height -= 1.0f;
//Save the current state so we don't persist anything beyond this operation
CGContextSaveGState(context);
//
// MNDocumentController.h
// MindNodeTouch
//
// Created by Markus Müller on 22.12.08.
// Copyright 2008 Markus Müller. All rights reserved.
//
#import <Foundation/Foundation.h>
@class MNDocumentReference;
@kwylez
kwylez / gist:1348851
Created November 8, 2011 19:30
Loading Local UIWebView with GCD
UIWebView *webView = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
webView.delegate = self;
webView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin;
NSURL *htmlPath = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"about" ofType:@"html"]isDirectory:NO];
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
dispatch_async(queue, ^{
@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:
@dhoerl
dhoerl / KeychainItemWrapper.h
Last active April 4, 2023 08:15
KeychainItemWrapper ARCified. Added the ability to manage a dictionary in place of just a string - the #define PASSWORD_USES_DATA in the .m file switches the mode.
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of