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
#0> non-block call | |
Thread.new do | |
blahbla... | |
end | |
#1> 4 simple ways to call shell or cmd | |
`ps aux` |
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
##################### | |
# JENKINS step #1 | |
# add to it's own execute shell section | |
##################### | |
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer | |
xcodebuild -target GuildBrowserLogicTests \ | |
-sdk iphonesimulator \ | |
-configuration Debug \ |
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
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
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
# Xcode | |
build/* | |
*.pbxuser | |
!default.pbxuser | |
*.mode1v3 | |
!default.mode1v3 | |
*.mode2v3 | |
!default.mode2v3 | |
*.perspectivev3 | |
!default.perspectivev3 |
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
//1.位置定位(最简单就是当前应用所有者所持设备的地理位置),主要用到的API类 CLLicationManager。 | |
//iOS提供了一个叫作CoreLocation.framework的框架。使用他可以取到自己的定位信息(经纬度)。请参考下面代码片段 | |
self.locationManager = [[CLLocationManager alloc]init]; | |
if([CLLocationManager locationServicesEnabled]){ | |
//设置代理 | |
[self.locationManager setDelegate:self]; | |
//设置精准度, | |
[self.locationManager setDesiredAccuracy:kCLLocationAccuracyBest]; | |
[self.locationManager startUpdatingLocation]; | |
} |
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
def intersect1(a, b) | |
result = [] | |
for x in a | |
for y in b | |
result.push(x) if x == y | |
end | |
end | |
return result | |
end |
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
create table test1 ( col1 integer not null, col2 integer ); | |
create index test1_col1_ix on test1 (col1); | |
alter table test1 | |
add constraint test1_pk primary key (col1) | |
using index test1_col1_ix; | |
insert into test1 values (1,1); |
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
//普通的 | |
- (NSInteger)fibonacci:(NSInteger)n { | |
if (n > 2) { | |
return [self fibonacci:n - 1] + [self fibonacci:n - 2]; | |
} | |
return n > 0 ? 1 : 0; | |
} | |
//改成用_cmd实现就变成了这样: | |
- (NSInteger)fibonacci:(NSInteger)n { |
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
//******************* | |
// NSBundle ofType | |
//******************* | |
NSString *textUrl = [[NSBundle mainBundle] pathForResource:@"myText" ofType:@"txt"]; | |
textView.text = [NSString stringWithContentsOfFile:textUrl encoding:NSUTF8StringEncoding error:nil]; |
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
// AZDelegationDemo.h | |
// Created by Aladdin Zhang on 8/24/11. | |
#import | |
@protocol AZDelegationDemoDelegate; | |
@interface AZDelegationDemo : NSObject{ | |
idAZDelegationDemoDelegate > delegate; | |
NSMutableArray * shoppingList; | |
} | |
@property (nonatomic,assign) idAZDelegationDemoDelegate > delegate; |
NewerOlder