This file contains hidden or 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
| cd /opt/git | |
| mkdir project.git | |
| cd project.git | |
| git --bare init |
This file contains hidden or 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
| UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 35)]; | |
| UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 15, 320, 20)]; | |
| CALayer *bottomBorder = [CALayer layer]; | |
| bottomBorder.frame = CGRectMake(0, 40, 320, .5); | |
| CALayer *rightBorder = [CALayer layer]; | |
| rightBorder.frame = CGRectMake(320, 0, 40, .5); | |
| CALayer *topBorder = [CALayer layer]; |
This file contains hidden or 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
| CLAuthorizationStatus authStatus = [CLLocationManager authorizationStatus]; | |
| if (authStatus == kCLAuthorizationStatusNotDetermined) { | |
| // _locationManager is CLLocationManager | |
| [_locationManager requestWhenInUseAuthorization]; | |
| return; | |
| } else if (authStatus == kCLAuthorizationStatusDenied || authStatus == kCLAuthorizationStatusRestricted) { | |
| // show location services denied alert | |
| return; | |
| } |
This file contains hidden or 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
| #pragma mark - UIActionSheetDelegate | |
| - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { | |
| if (buttonIndex == 0) { | |
| [self takePhoto]; | |
| } else if (buttonIndex == 1) { | |
| [self choosePhotoFromLibrary]; | |
| } | |
| } |
This file contains hidden or 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
| - (RACSignal *)authorizeToGithubUsingOauth { | |
| __weak GitHubClient *weakSelf = self; | |
| RACSignal *authorizeSignal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { | |
| CFUUIDRef uuid = CFUUIDCreate(NULL); | |
| NSString *uuidString = CFBridgingRelease(CFUUIDCreateString(NULL, uuid)); | |
| CFRelease(uuid); | |
| NSCharacterSet *slashSet = [NSCharacterSet characterSetWithCharactersInString:@"/"]; | |
| NSString *baseURLString = [BASE_WEB_URL stringByTrimmingCharactersInSet:slashSet]; | |
This file contains hidden or 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
| NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; | |
| AFURLSessionManager *sessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; | |
| NSURL *url = [NSURL URLWithString:apiURL]; | |
| NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; | |
| [request setHTTPMethod:method]; | |
| [request setValue:@"application/json" forHTTPHeaderField:@"Accept"]; | |
| if (isNeedToken) { | |
| [request setValue:[NSString stringWithFormat:@"token %@", self.token] forHTTPHeaderField:@"Authorization"]; | |
| } | |
This file contains hidden or 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 theano | |
| from pylearn2.models import mlp | |
| from pylearn2.training_algorithms import sgd | |
| from pylearn2.termination_criteria import EpochCounter | |
| from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix | |
| import numpy as np | |
| from random import randint | |
| class XOR(DenseDesignMatrix): |
This file contains hidden or 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
| git remote prune origin |
This file contains hidden or 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
| sudo service nginx stop |
This file contains hidden or 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
| NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"UTC"]; | |
| NSTimeZone* destinationTimeZone = [NSTimeZone localTimeZone]; | |
| NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; | |
| [dateFormatter setDateFormat:formatter]; | |
| [dateFormatter setTimeZone:sourceTimeZone]; | |
| NSDate *rawDate = [dateFormatter dateFromString:dateTime]; | |