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
static <T,U> List<U> map(List<T> list,{T=>U} transform) { | |
List<U> result = new ArrayList<U>(list.size()); | |
for (T t : list) { result.add(transform.invoke(t)); } | |
return result; | |
} | |
public static void main(String[] args) { | |
List<Color> colors = map(Arrays.asList(Flavor.values()), { Flavor f => f.color }); | |
System.out.println(colors.equals(Arrays.asList(Color.values()))); | |
} |
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
public Issue browse(Repository argRepository, int argIssueNo) { | |
RestTemplate template = new RestTemplate(); | |
template.setMessageConverters(new HttpMessageConverter[] { | |
new MappingJacksonHttpMessageConverter()}); | |
IssueResponse resp = template.getForObject(BASE_URL + "issues/show/{username}/{repo}/{no}", IssueResponse.class, | |
argRepository.getOwner(), argRepository.getName(), String.valueOf(argIssueNo)); | |
return resp.getIssue(); | |
} |
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
public class IssueResponse { | |
private Issue issue; | |
public Issue getIssue() { | |
return issue; | |
} | |
public void setIssue(Issue argIssue) { | |
issue = argIssue; | |
} | |
} |
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
{"issue": | |
{"number":1,"votes":0,"created_at":"2009/11/01 07:27:56 -0800", | |
"body":"This is a sample issue! Used in my RestTemplateSample!", | |
"title":"Sample Issue", | |
"updated_at":"2009/11/01 09:16:58 -0800","closed_at":null, | |
"user":"dlinsin","labels":["minor"],"state":"open" | |
} | |
} |
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)viewWillAppear:(BOOL)animated { | |
[super viewWillAppear:animated]; | |
tableViewNavigationBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 44.0f)]; | |
UIImage *image = [UIImage imageNamed:@"synyx_150_no_os.png"]; | |
imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(84.0, 1.0, image.size.width, image.size.height) ]; | |
[imageView setImage:image]; | |
[tableViewNavigationBar addSubview:imageView]; |
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
// | |
// RouteController.m | |
// synyx | |
// | |
// Created by David Linsin on 10/12/09. | |
// Copyright 2010 Synyx GmbH & Co. KG. All rights reserved. | |
// | |
#import "RouteController.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
#import "NSObject+YAJL.h" | |
NSDictionary *vals = [jsonResponse yajl_JSON]; | |
[player fill:vals]; | |
- (void)fill:(NSDictionary *)vals { | |
NSString *key; | |
for (key in vals) { | |
[self setValue:[vals objectForKey:key] forKey:key]; | |
} |
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)initWithParent:(UIView *)parent { | |
self = [self initWithFrame:CGRectZero]; | |
if (!self) | |
return nil; | |
[parent addSubview:self]; | |
return self; | |
} | |
+ (id) viewWithParent:(UIView *)parent { | |
return [[[self alloc] initWithParent:parent] autorelease]; | |
} |
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
@synthesize pageIndex = _pageIndex; | |
- (id) initWithParent:(UIView *)parent { | |
self = [super initWithParent:parent]; | |
if (self == nil) { | |
return nil; | |
} | |
self.userInteractionEnabled = YES; | |
self.size = self.window.size; | |
[[UIImageView viewWithParent:self] setImageWithName:@"dailies"]; |
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
// Person.h | |
@interface Person { | |
NSString *name; | |
} | |
@property (retain) NSString *name; | |
@end |