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
/** | |
# Usages: | |
pfv.start('some'); | |
// some code | |
// some code | |
pfv.end(); | |
pfv.check('ff', () => { | |
// some code |
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 forFunc(curr, compare, changer, actions) { | |
if (compare(curr)) { | |
actions(curr); | |
return forFunc(changer(curr), compare, changer, actions); | |
} | |
} | |
function iterateArr(arr, actions) { | |
forFunc(0, i => i < arr.length, i => i+1, i => actions(arr[i], i)); | |
} |
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
//DataSource.prototype.discoverSchemas | |
//async.parallel(tasks, function (err, results) { | |
// console.log(results); | |
//https://github.com/strongloop/loopback-datasource-juggler/blob/master/lib/datasource.js#L1205 | |
[ | |
[ | |
{ owner: 'chosendb', | |
tableName: 'chosentable', | |
columnName: 'id' | |
}, |
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
-(NSString *)md5:(NSString *)str { | |
//转换成utf-8 | |
const char *cStr = [str UTF8String]; | |
//开辟一个16字节(128位:md5加密出来就是128位/bit)的空间(一个字节=8字位=8个二进制数) | |
unsigned char result[16]; | |
CC_MD5( cStr, strlen(cStr), result); | |
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
SomeCell * cell = [tableView dequeueReusableCellWithIdentifier:@"someIdentifier"]; | |
if(cell == nil){ | |
cell = [[SomeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"someIdentifier"]; | |
} |
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
// 定义一个UIActionSheet | |
UIActionSheet *actionSheet = [[UIActionSheet alloc] | |
initWithTitle:@"Are you sure?" | |
delegate:self | |
cancelButtonTitle:@"No Way!" | |
destructiveButtonTitle:@"Yes, I'm Sure" | |
// 其他按钮,没有直接写nil | |
otherButtonTitles:@"Foo",@"Bar",nil]; | |
// 放到View中显示 |
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
/*让position:fixed在IE6下可用! */ | |
.fixed-top /* 头部固定 */{position:fixed;bottom:auto;top:0px;} | |
.fixed-bottom /* 底部固定 */{position:fixed;bottom:0px;top:auto;} | |
.fixed-left /* 左侧固定 */{position:fixed;right:auto;left:0px;} | |
.fixed-right /* 右侧固定 */{position:fixed;right:0px;left:auto;} | |
/* 上面的是除了IE6的主流浏览器通用的方法 */ | |
* html,* html body /* 修正IE6振动bug */{background-image:url(about:blank);background-attachment:fixed;} | |
* html .fixed-top /* IE6 头部固定 */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));} | |
* html .fixed-right /* IE6 右侧固定 */ {position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||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
<object type="application/x-shockwave-flash" | |
data="c.swf?path=movie.swf" | |
width="400" height="300"> | |
</object> |
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
/** | |
* [checkMail 验证用户输入的邮箱格式是否正确] | |
* @param {[string]} mailStr [已经去除两边空白的邮箱地址] | |
* @return {[int]} [0,合法;1,不合法] | |
*/ | |
function checkMail(mailStr){//验证邮箱格式 | |
if(mailStr.match(/^[\w-]+@[\w-]+((\.[\w-]{2,3}){1,2})$/gi)){return 0;} | |
else{return 1;} | |
} |
NewerOlder