Skip to content

Instantly share code, notes, and snippets.

entityForName:@"Event"
@ChrisDrit
ChrisDrit / gist:713304
Created November 24, 2010 08:04
parserDidEndDocument
// dump to database
[self insertNewObject];
@ChrisDrit
ChrisDrit / gist:713299
Created November 24, 2010 07:59
cellForRowAtIndexPath
Stories *story = (Stories *)[self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = story.title;
[item setObject:currentTitle forKey:@"title"];
[item setObject:currentLink forKey:@"link"];
[item setObject:currentSummary forKey:@"summary"];
[item setObject:currentDate forKey:@"date"];
[stories addObject:[item copy]];
NSString * path = @"http://feeds.feedburner.com/TheAppleBlog";
[self parseXMLFileAtURL:path];
- (void)parseXMLFileAtURL:(NSString *)URL;
- (void)parserDidStartDocument:(NSXMLParser *)parser;
- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError;
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName ...
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName ...
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string;
- (void)parserDidEndDocument:(NSXMLParser *)parser;
entityForName:@"Stories"
@ChrisDrit
ChrisDrit / gist:724665
Created December 2, 2010 02:57
Custom image position within a TableViews Cell
UIImageView *iconView = [[[UIImageView alloc] initWithFrame:CGRectMake(
50,
25,
24,
16
)] autorelease];
UIImage *iconImage = [UIImage imageNamed:@"eye.png"];
iconView.image = iconImage;
[[cell contentView] addSubview:iconView];
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
<h3>Collect Name of&nbsp;Restaurant, Phone Number and Address from URL provided.</h3>
<div class="highlight-box">
<ul>
<li>For this &quot;HIT url&quot; below, enter the Name of the Restaurant,&nbsp;the Phone Number, and the Address</li>
</ul>
<ul>
<li>Example - Name of Restaurant:&nbsp;<b><i>Guerilla Cafe</i></b></li>
<li>Example - Phone Number:&nbsp;<b><i>(510) 845-2233</i></b></li>
<li>Example - Address:&nbsp;<b><i>1620 Shattuck Ave, Berkeley, CA 94709</i></b></li>
<li>Exmaple above can be found at this url (<u>this is only an example url and <b>NOT</b> the &quot;HIT url&quot; - do <b>NOT</b> collect data from this example url</u>):&nbsp;http://bit.ly/UR3Oki</li>