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) validateCivilID:(NSString *)civilID { | |
bool valid = false; | |
NSString *regex = @"[0-9]{12}"; | |
NSPredicate *test = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex]; | |
if ([test evaluateWithObject:civilID]) { | |
double test = 11 - (([[civilID substringWithRange:NSMakeRange(0, 1)] integerValue] * 2) + | |
([[civilID substringWithRange:NSMakeRange(1, 1)] integerValue] * 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
function validate_civilid($str) { | |
$valid = false; | |
if(preg_match("/[0-9]/{12}", $str)) { | |
$test = ((substr($str, 0, 1) * 2) + ((substr($str, 1, 1) * 1) + ((substr($str, 2, 1) * 6) + ((substr($str, 3, 1) * 3) + ((substr($str, 4, 1) * 7) + ((substr($str, 5, 1) * 9) + ((substr($str, 6, 1) * 10) + ((substr($str, 7, 1) * 5) + ((substr($str, 8, 1) * 8) + ((substr($str, 9, 1) * 4) + ((substr($str, 10, 1) * 2) ) % 11; | |
if($test == substr($str, 11, 1)) $valid = true; | |
} | |
return $valid; |
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
<select name="nationality"> | |
<option value="">-- select one --</option> | |
<option value="afghan">Afghan</option> | |
<option value="albanian">Albanian</option> | |
<option value="algerian">Algerian</option> | |
<option value="american">American</option> | |
<option value="andorran">Andorran</option> | |
<option value="angolan">Angolan</option> | |
<option value="antiguans">Antiguans</option> | |
<option value="argentinean">Argentinean</option> |
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
function nationalityDropdown ($name, $id, $selected, $class="form-control") { | |
$arr = array('Afghan','Albanian','Algerian','American','Andorran','Angolan','Antiguans','Argentinean','Armenian','Australian','Austrian','Azerbaijani','Bahamian','Bahraini','Bangladeshi','Barbadian','Barbudans','Batswana','Belarusian','Belgian','Belizean','Beninese','Bhutanese','Bolivian','Bosnian','Brazilian','British','Bruneian','Bulgarian','Burkinabe','Burmese','Burundian','Cambodian','Cameroonian','Canadian','Cape Verdean','Central African','Chadian','Chilean','Chinese','Colombian','Comoran','Congolese','Costa Rican','Croatian','Cuban','Cypriot','Czech','Danish','Djibouti','Dominican','Dutch','East Timorese','Ecuadorean','Egyptian','Emirian','Equatorial Guinean','Eritrean','Estonian','Ethiopian','Fijian','Filipino','Finnish','French','Gabonese','Gambian','Georgian','German','Ghanaian','Greek','Grenadian','Guatemalan','Guinea-Bissauan','Guinean','Guyanese','Haitian','Herzegovinian','Honduran','Hungarian','Icelander','India |
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
server { | |
listen 80; ## listen for ipv4; this line is default and implied | |
#listen [::]:80 default ipv6only=on; ## listen for ipv6 | |
root /usr/share/nginx/www; | |
index index.html index.htm; | |
# Make site accessible from http://localhost/ | |
server_name localhost; |
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
func delay(withTime: Double, callback: @escaping () -> Void) { | |
let when = DispatchTime.now() + withTime | |
DispatchQueue.main.asyncAfter(deadline: when) { | |
callback() | |
} | |
} |
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
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) | |
{ | |
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]]; | |
[[UIApplication sharedApplication] registerForRemoteNotifications]; | |
} | |
else | |
{ | |
[[UIApplication sharedApplication] registerForRemoteNotificationTypes: | |
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)]; | |
} |
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 activePush = 1; | |
if ([application respondsToSelector:@selector(isRegisteredForRemoteNotifications)]) { | |
activePush = ([application isRegisteredForRemoteNotifications]) ? 1 : 0; | |
} | |
else { | |
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; | |
if (types == UIRemoteNotificationTypeNone) activePush = 0; | |
} |
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
server { | |
listen 80; | |
server_name example.com; | |
root /usr/share/nginx/example.com/web; | |
index index.php index.html; | |
location ~* ^/(assets|files|robots\.txt) { } | |
location / { | |
if (-f $request_filename) { |
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
location /your_subdirectory { | |
alias /var/www/html/your_subdirectory/web; | |
index index.php index.html; | |
if (-f $request_filename) { | |
break; | |
} | |
rewrite ^(.*)$ /your_subdirectory/index.php last; | |
} | |
location ~ /your_subdirectory/(.+)\.php(/|$) { |
OlderNewer