View validateAnEmail.m
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
- (BOOL) validateEmail: (NSString *) candidate { | |
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; | |
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; | |
return [emailTest evaluateWithObject:candidate]; | |
} |
View window_subview_rotate_by_orientation.m
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
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameOrOrientationChanged:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameOrOrientationChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil]; | |
- (void)statusBarFrameOrOrientationChanged:(NSNotification *)notification | |
{ | |
/* | |
This notification is most likely triggered inside an animation block, | |
therefore no animation is needed to perform this nice transition. |
View LaunchFiles
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
PORTRAIT | |
---------------------------------------------- | |
iPhone Retina HD 5.5 1242×2208 | |
iPhone Retina HD 4.7 750×1334 | |
iPhone Non Retina 3.5 320 x 480 | |
iPhone Retina 3.5 640 x 960 pixels | |
iPhone Retina 4 inch 640 x 1136 pixels |
View Text Input Limit By Characterset
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
-(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string | |
{ | |
NSCharacterSet *cs = [[NSCharacterSet characterSetWithCharactersInString:@"0123456789+-"] invertedSet]; | |
NSString *filtered = [[string componentsSeparatedByCharactersInSet:cs] componentsJoinedByString:@""]; | |
return [string isEqualToString:filtered]; | |
} |
View gist:24e85b259fd21dc4666c
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)fillProfile | |
{ | |
RevMobAds *revmob = [RevMobAds session]; | |
[[FBRequest requestForGraphPath:@"me?fields=id,gender,age_range,birthday"] startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) { | |
if (error == nil) { | |
NSString *gender = [result objectForKey:@"gender"]; | |
if (gender != nil) | |
revmob.userGender = [gender isEqualToString:@"male"] ? RevMobUserGenderMale : RevMobUserGenderFemale; | |
NSNumber *minAge = [[result objectForKey:@"age_range"] objectForKey:@"min"]; |
View Common-Currency.json
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
{ | |
"USD": { | |
"symbol": "$", | |
"name": "US Dollar", | |
"symbol_native": "$", | |
"decimal_digits": 2, | |
"rounding": 0, | |
"code": "USD", | |
"name_plural": "US dollars" | |
}, |
View USA_states_hash.json
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
{ | |
"AL": "Alabama", | |
"AK": "Alaska", | |
"AS": "American Samoa", | |
"AZ": "Arizona", | |
"AR": "Arkansas", | |
"CA": "California", | |
"CO": "Colorado", | |
"CT": "Connecticut", | |
"DE": "Delaware", |
View fix_symlinks_fmk_ios.sh
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
#!/bin/bash | |
########################################################## | |
# Fix Symlinks | |
# | |
# Usage : Copy this file into the Framework directory, | |
# Execute it passing the Framework Name in argument. | |
# | |
########################################################## | |
if [ -z $1 ] ; then |
View ios-build-framework-script.sh
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
# For actual device testing, disabled the script running by uncomment following two lines. | |
########################################################################################## | |
#echo "SCRIPT RUNNING ABORTED. COMMENT THIS OUT TO GENERATE UNIVERSAL FRAMEWORK" | |
#exit 0 | |
########################################################################################## | |
set -e | |
set +u | |
# Avoid recursively calling this script. | |
if [[ $SF_MASTER_SCRIPT_RUNNING ]] |
View rotate_video.m
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
//setting up the first video based on previous recording | |
CMTimeRange videoDuration = CMTimeRangeMake(kCMTimeZero, [self.previousRecording duration]); | |
AVAssetTrack *clipVideoTrack = [[self.previousRecording tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; | |
AVAssetTrack *clipAudioTrack = [[self.previousRecording tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]; | |
[compositionVideoTrack insertTimeRange:videoDuration ofTrack:clipVideoTrack atTime:nextClipStartTime error:nil]; | |
[compositionAudioTrack insertTimeRange:videoDuration ofTrack:clipAudioTrack atTime:nextClipStartTime error:nil]; | |
//our first track instruction - set up the instruction layer, then check the orientation of the track | |
//if the track is in landscape-left mode, it needs to be rotated 180 degrees (PI) | |
AVMutableVideoCompositionLayerInstruction *firstTrackInstruction = |