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 object2QueryString(obj) { | |
let queryString = '' | |
if (Object.keys(obj).length) { | |
queryString = Object | |
.keys(obj) | |
.map(k => k + '=' + obj[k]) | |
.reduce((a, b) => a + '&' + b, '') | |
} | |
return queryString.slice(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
'use strict' | |
const _ = require('lodash') | |
const LOGGER_PREFIX = '[CHUNK_TASK_MANAGER]***' | |
function sleep(s) { | |
return new Promise(resolve => setTimeout(resolve, s * 1000)) | |
} |
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
/** | |
* | |
* @param fn | |
* @returns {Promise} | |
* eg: thunkToPromise(fs.readdir, path).then() | |
*/ | |
function thunkToPromise(fn) { | |
var ctx = this | |
var args = Array.prototype.slice.call(arguments, 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
--- | |
Language: Cpp | |
# BasedOnStyle: WebKit | |
AccessModifierOffset: -4 | |
AlignAfterOpenBracket: false | |
AlignEscapedNewlinesLeft: false | |
AlignOperands: false | |
AlignTrailingComments: false | |
AlignConsecutiveAssignments: false | |
AllowAllParametersOfDeclarationOnNextLine: true |
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
BasedOnStyle: Google | |
# @public等访问修饰符相对IndentWidth的偏移,@public缩进2个空格(4 + (-2)) | |
AccessModifierOffset: -2 | |
# 赋值语句等号对齐 | |
AlignConsecutiveAssignments: false | |
# 缩进改为4个空格 | |
IndentWidth: 4 | |
ObjCBlockIndentWidth: 4 | |
# 每行最多100个字符 | |
ColumnLimit: 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
##关键名词 | |
* 工作区(Working area):就是咱们刚才创建的mygit文件夹。 | |
* 暂存区(Staging area):对文件操作(也就是需要提交的文件修改)的地方就叫暂存区。--注意:这里的修改包括对文件的增删改。 | |
* 版本库(Repository):就是你所看到的的那个隐藏的“.git”目录,它就是咱们的版本(仓)库。 | |
##常用命令 | |
1. git config --global user.name "your name" 配置用户名 | |
2. git config --global user.email "email@example.com" 配置用户邮箱 | |
3. mkdir mygit && cd mygit && git init 初始化空的git仓库 | |
4. git status && git add && git commit 增加文件到暂存区 |
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
正则入门:http://deerchao.net/tutorials/regex/regex.htm | |
正则验证:http://tool.oschina.net/regex?optionGlobl=global# | |
======================= | |
常规 | |
======================= | |
+ 验证邮箱 | |
^\w+(\.\w+)*@[a-zA-Z0-9-]{2,}\.[a-zA-Z]{2,} |
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
2014-08-26 15:26:35.488 iStat[4777:578395] Font FamilyNames | |
2014-08-26 15:26:35.488 iStat[4777:578395] Font Family: Marion | |
2014-08-26 15:26:35.488 iStat[4777:578395] Marion-Italic | |
2014-08-26 15:26:35.488 iStat[4777:578395] Marion-Bold | |
2014-08-26 15:26:35.488 iStat[4777:578395] Marion-Regular | |
2014-08-26 15:26:35.489 iStat[4777:578395] Font Family: Copperplate | |
2014-08-26 15:26:35.489 iStat[4777:578395] Copperplate-Light | |
2014-08-26 15:26:35.489 iStat[4777:578395] Copperplate | |
2014-08-26 15:26:35.489 iStat[4777:578395] Copperplate-Bold | |
2014-08-26 15:26:35.489 iStat[4777:578395] Font Family: Heiti SC |
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
//worst | |
NSArray *sessionsFromServer = ...; | |
NSManagedObjectContext *context = ...; | |
for (WWDCSession *aSession in sessionsFromServer) { | |
NSFetchRequest *req = [NSFetchRequest fetchRequestWithEntityName:@"WWDCSession"]; | |
req.predicate = [NSPredicate predicateWithFormat:@"sessionID == %@", aSession.sessionID]; | |
NSArray *results = [context executeFetchRequest:req error:nil]; | |
WWDCSession *existSesion = [results firstObject]; |