This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIGraphicsBeginImageContext(self.bounds.size); | |
[theView.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
UIImageWriteToSavedPhotosAlbum(viewImage,nil,NULL,NULL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *url = [[NSString alloc] initWithString:@"http://farm2.static.flickr.com/1204/789803401_0017756904.jpg"]; | |
UIWebImageView *webImage = [[UIWebImageView alloc] initWithFrame:CGRectMake(0,0,300,300) andUrl:url]; | |
[[self view] addSubview:webImage]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'csv' | |
file = "db/commission_junction/2087028_18584_20080827.csv" | |
cols, *rows = CSV::Reader.parse(File.open(file)).to_a | |
collection = rows.collect { |row| Hash[*cols.zip(row).flatten] } | |
puts collection.first.inspect | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample usage: | |
# class Collection | |
# include Typhoeus | |
# remote_defaults :on_success => lambda {|response| JSON.parse(response.body)}, | |
# :on_failure => lambda {|response| puts "error code: #{response.code}"}, | |
# :base_uri => "http://localhost:9292", | |
# :is_resource => true | |
# end | |
module Typhoeus |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// EGOCache.h | |
// enormego | |
// | |
// Created by Shaun Harrison on 7/4/09. | |
// Copyright 2009 enormego. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// UITableViewCell+CustomNib.h | |
// UBlossom | |
// | |
// Created by Christopher Burnett on 7/22/09. | |
// Copyright 2009 digital scientists, llc. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface UITableViewCell (CustomNib) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)setEditing:(BOOL)editing animated:(BOOL)animated{ | |
lifeAreaTab.hidden = editing; | |
[super setEditing:editing animated:animated]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tmp is an incoming array of data from the server | |
// nearestExits is the existing store | |
for (int i=0; i<[tmp count]; i++) { | |
InterstateExit *incomingExit = [tmp objectAtIndex:i]; | |
InterstateExit *existingExit = [self.nearestExits objectAtIndex:i]; | |
if (![incomingExit.interstateExitID isEqualToNumber:existingExit.interstateExitID]) { | |
NSIndexPath *pathToRemove = [NSIndexPath indexPathForRow:i inSection:0]; | |
[self.nearestExits removeObjectAtIndex:i]; // remove the item from my datasource | |
[self.exitTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:pathToRemove] withRowAnimation:UITableViewRowAnimationFade]; | |
[self.nearestExits insertObject:incomingExit atIndex:i]; // add the new item to the datasource |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLLocationCoordinate2D myHouse; | |
myHouse.latitude = 33.760174; | |
myHouse.longitude = -84.332780; | |
[GLocation getLocalResultsForLocation:myHouse withQuery:@"Restaurants" withDelegate:self]; | |
// Returns | |
/* | |
GLocationTest/testResultsForGLocation 2009-10-27 23:41:16.803 Unit Tests[41965:207] <Flying Biscuit Cafe 1655 McLendon Ave NE Atlanta GA 33.764835 -84.333260> | |
2009-10-27 23:41:16.803 Unit Tests[41965:207] <Radial Cafe 1530 Dekalb Ave NE Atlanta GA 33.762775 -84.337692> | |
2009-10-27 23:41:16.804 Unit Tests[41965:207] <La Fonda Latina 1639 McLendon Ave NE Atlanta GA 33.764652 -84.333778> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "CLLocation+Vector.h" | |
#define CARDINAL_DIRECTIONS [NSArray arrayWithObjects:@"North",@"Northeast",@"East",@"Southeast",@"South",@"Southwest",@"West",@"Northwest",nil] | |
@implementation CLLocation(Vectors) | |
- (float)angleBetween:(CLLocationCoordinate2D)coord | |
{ | |
float lat1 = self.coordinate.latitude * M_PI / 180.0; |
OlderNewer