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
| /** | |
| * Load | |
| * | |
| * @param {Object} options | |
| * @param {Function} cb | |
| * @api private | |
| */ | |
| schema.statics.load = function (options, cb) { | |
| var criteria = options.criteria || {} |
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
| - (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { | |
| NSLog(@"%s", __PRETTY_FUNCTION__); | |
| switch (status) { | |
| case kCLAuthorizationStatusAuthorized: | |
| NSLog(@"kCLAuthorizationStatusAuthorized"); | |
| // Re-enable the post button if it was disabled before. | |
| self.navigationItem.rightBarButtonItem.enabled = YES; | |
| [locationManager startUpdatingLocation]; | |
| break; | |
| case kCLAuthorizationStatusDenied: |
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
| if ((![CLLocationManager locationServicesEnabled]) | |
| || ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted) | |
| || ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied)) { | |
| UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Error", nil) message:NSLocalizedString(@"Location services must be enabled in Settings.", nil) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; | |
| [alertView show]; |
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 <UIKit/UIKit.h> | |
| @interface HPGroupSelectViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> | |
| @end |
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
| - (void)textFieldDidBeginEditing:(UITextField *)textField | |
| { | |
| int remainder = MAX_CHARACTER_COUNT - textField.text.length; | |
| self.counterLabel.text = [NSString stringWithFormat:@"%d", remainder]; | |
| if (textField == self.activityNameTextField) { | |
| self.counterLabel.yOrigin = self.activityNameContainerView.yOrigin; | |
| [self closePlaceTableView]; | |
| } else { |
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
| NSString *s = @"The weather on \U0001F30D is \U0001F31E today."; | |
| // The weather on 🌍 is 🌞 today. | |
| NSRange fullRange = NSMakeRange(0, [s length]); | |
| [s enumerateSubstringsInRange:fullRange | |
| options:NSStringEnumerationByComposedCharacterSequences | |
| usingBlock:^(NSString *substring, NSRange substringRange, | |
| NSRange enclosingRange, BOOL *stop) | |
| { | |
| NSLog(@"%@ %@", substring, NSStringFromRange(substringRange)); | |
| }]; |
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
| NSUInteger realLength = [s lengthOfBytesUsingEncoding:NSUTF32StringEncoding] / 4; | |
| NSLog(@"The real length of %@ is %lu", s, realLength); | |
| // => The real length of 🌍 is 1 |
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
| // http://www.objc.io/issue-9/unicode.html | |
| NSString *s = @"\u00E9"; // é | |
| NSString *t = @"e\u0301"; // e + ´ | |
| BOOL isEqual = [s isEqualToString:t]; | |
| NSLog(@"%@ is %@ to %@", s, isEqual ? @"equal" : @"not equal", t); | |
| // => é is not equal to é | |
| // Normalizing to form C | |
| NSString *sNorm = [s precomposedStringWithCanonicalMapping]; | |
| NSString *tNorm = [t precomposedStringWithCanonicalMapping]; |
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
| var allowCrossDomain = function(req, res, next) { | |
| res.header('Access-Control-Allow-Origin', '*'); | |
| res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); | |
| res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization'); | |
| if ('OPTIONS' == req.method) { | |
| res.send(200); | |
| } | |
| else { | |
| next(); |
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
| } else if ([choice isEqualToString:@"Feedback"]) { | |
| if ([MFMailComposeViewController canSendMail]) | |
| { | |
| MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init]; | |
| mailer.mailComposeDelegate = self; | |
| [mailer setSubject:@"[Hopp2IT] Feedback"]; | |
| NSString * version = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"]; | |
| NSString *device = ([HPManager isiPhone5]) ? @"iPhone5" : @"<=iPhone4"; | |
| NSString *messageBody = [NSString stringWithFormat:@"\n\n~~~~~~~~~~~~~~\nPlatform: iOS\nDevice: %@\nVersion: %@\n",device,version]; | |
| [mailer setMessageBody:messageBody isHTML:NO]; |
OlderNewer