1 | versionCompare = function(left, right) { |
js-监听弹窗弹出
1 | $('#code').on('shown.bs.modal', function (e) { |
ps: 想监听全部 将selector 变成$(‘.modal’)就可以了
js-阻止input 按enter键提交表单
1 | <input onkeydown="if(event.keyCode==13){return false;}" type="text" name="email[to]" id="email_to"> |
regex-email address
基于RFC5322 的email合法判断
/(?:[a-z0-9!#$%&’+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&’+/=?^_`{|}~-]+)|”(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])“)@(?:(?:a-z0-9?.)+a-z0-9?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\[\x01-\x09\x0b\x0c\x0e-\x7f])+)])/
ios-获取wkwebview里的cookie
1 | if (@available(iOS 11.0, *)) { //available on iOS 11+ |
ios-字符串进阶
NSString *a = @”8e0c2412021270fb_gr_session_id=3bb8f9ed-0203-42e4-b25c-98e49206ec0e; 8e0c2412021270fb_gr_session_id_3bb8f9ed-0203-42e4-b25c-98e49206ec0e=true; _ResumeHack_session=am4rQW5SdldaQlQ5eHVpZ1dvWWx3ZE9Yc201WFlTLzBOVUdNMitsYU42UjJIUFU1djR4WDJUT0tvN0dUaVhtdFk1b1dkSE9DNEtXdlFHL2tNM3pLeFFPZ1JZMGlXUGwyUDhkUUVEUythcWoweThGTzBRWVNucDZVVUR4RXNyQVhxY0t2QXRBaEhHWDl6SEdyaGNwMHZJRjlJeVVGcWIwZlRCMWRvMStwNDJMeDIxaDl5bTJKN0NYMWQ0ejdlSlFSTHVUMU4zeEEzbmRXQUNyZGE0V2xyMVlKNzdWeXVqM0VIUmF1TmlybXRoUnNkVFhWNGxiVDNlOWVDYTRQeVFLdC0tVXlETG1xTjcvd25RVmlveFV0RHQxdz09–50662a5248ec2615aaf0098440ba6b9f02492971; __profilin=p%3Dt; gr_user_id=aa9e2d55-23c1-485a-bd88-c51f314824e2; grwng_uid=5d7e8aba-8f56-4950-975c-b8c44d85d7fb”;
NSString *b = @”_ResumeHack_session”;
NSString *c = @"__profilin";
NSString *d = [NSString stringWithFormat:@"%@%@",[self achieveStringWithRootString:a key:b],[self achieveStringWithRootString:a key:c]];
NSLog(@"----->%@",d);
}
- (NSString *)achieveStringWithRootString:(NSString *)rootString
NSRange aRange = [rootString rangeOfString:[NSString stringWithFormat:@”%@=”,key]];key:(NSString *)key{
NSString *c = [rootString substringFromIndex:aRange.location];
NSRange bRange = [c rangeOfString:@”;”];//匹配得到的下标
NSString *d = [c substringToIndex:bRange.location + bRange.length];
return d;
}
微信小程序-发送消息通知
1.get access token
1 | res = RestClient.get 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid='+app_id + '&secret=' + app_secret |
rails-性能测试
https://ruby-doc.org/stdlib-1.9.3/libdoc/benchmark/rdoc/Benchmark.html
在数据量较大的时候我们可能需要测试跑一个程序所需要的时间 这个时候就可以用
benchmark
Benchmark.realtime{ xxxxx}
ios-wkwebview 加载进度条
interface里
1 | @property (weak, nonatomic) CALayer *progresslayer; |