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)drawRect:(CGRect)rect { | |
//draw the base | |
UIBezierPath* baseArc = [UIBezierPath bezierPathWithArcCenter:CGPointMake(CGRectGetWidth(self.bounds) / 2, CGRectGetHeight(self.bounds) / 2) | |
radius:self.bounds.size.height/2-24 | |
startAngle:DEGREES_TO_RADIANS(180) | |
endAngle:DEGREES_TO_RADIANS(360) | |
clockwise:YES]; | |
[[UIColor grayColor] setStroke]; | |
baseArc.lineWidth = 24; | |
[baseArc stroke]; |
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
new-host-3:~ swall$ ios devices:list --trace | |
/Users/swall/.rvm/gems/ruby-1.9.2-p290/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError) | |
from /Users/swall/.rvm/gems/ruby-1.9.2-p290/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `block in connect' | |
from /Users/swall/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:44:in `timeout' | |
from /Users/swall/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/timeout.rb:89:in `timeout' | |
from /Users/swall/.rvm/gems/ruby-1.9.2-p290/gems/net-http-persistent-2.7/lib/net/http/persistent/ssl_reuse.rb:70:in `connect' | |
from /Users/swall/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:637:in `do_start' | |
from /Users/swall/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:632:in `start' | |
from /Users/swall/.rvm/gems/ruby-1.9.2-p290/gems/net-http-persistent-2.7/lib/net/http/persistent.rb:511:in `conne |
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
#!/usr/bin/env python | |
import urllib2 | |
import json | |
result = json.load(urllib2.urlopen('http://api.twitter.com/1/trends/daily.json')) | |
for date,trends in result['trends'].iteritems(): | |
print date | |
for trend in trends: | |
print trend['query'] |
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
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) { | |
size_t num_locations = 2; | |
CGFloat locations[2] = { 0.0, 1.0 }; | |
CGFloat components[8] = { 1.0, 1.0, 1.0, 0.0, // Start color | |
1.0, 1.0, 1.0, 1.0 }; // End color | |
CGColorSpaceRef rgbColorspace = CGColorSpaceCreateDeviceRGB(); | |
CGGradientRef gradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations); |
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)drawRect:(CGRect)rect | |
{ | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
UIBezierPath *path = [UIBezierPath bezierPathWithRect:rect]; | |
//To create a 1.0f borderWidth | |
CGRect innerRect = rect; | |
innerRect.origin.x += 1.0f; | |
innerRect.origin.y += 1.0f; | |
innerRect.size.width -= 2.0f; |
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
/* | |
* SenTestingKit does not wait for blocks to finish by default so your test would simply complete | |
* as successful. You need to use a semaphore and keep the run loop going in order for the test | |
* to properly run. | |
*/ | |
- (void)testGetSpots { | |
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); | |
CLLocation location = [[CLLocation alloc] initWithLatitude:70.0 longitude:50.0]; | |
[Spot spotsWithURLString:@"/spots" near:location parameters:[NSDictionary dictionaryWithObject:@"128" forKey:@"per_page"] block:^(NSArray *records) { | |
//sample assert |