This file contains hidden or 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 uuidv4() { | |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { | |
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); | |
return v.toString(16); | |
}); | |
} | |
console.log(uuidv4()) |
This file contains hidden or 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
const getValue = (obj, keyChain = '', defaultValue = undefined) => { | |
if (typeof keyChain !== 'string' || keyChain === '' || !obj) return defaultValue || false; | |
const check = (object, keyArr, hasNext = false) => { | |
return ['[object Null]', '[object Undefined]'].indexOf(Object.prototype.toString.call(object[keyArr[0]])) === -1 | |
? keyArr[1] | |
? check(object[keyArr[0]], keyArr.slice(1)) | |
: object[keyArr[0]] | |
: hasNext ? undefined : defaultValue; | |
}; |
This file contains hidden or 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 copyToClipboard(element) { | |
var $temp = $("<textarea></textarea>"); | |
$("body").append($temp); | |
$temp.text("aaaa").select(); | |
document.execCommand("copy"); | |
$temp.remove(); | |
} |
This file contains hidden or 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
// Learnd From @石濑 | |
// Fetch Data | |
const request = new Promise(function(resolve, reject) { | |
fetch( | |
sth, | |
success => resolve('data'), | |
fail=> reject('reason') | |
); | |
}) |
This file contains hidden or 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 range(len){ | |
return Array.apply(null, Array(len)).map(function (v,k) { return k }); | |
} |
This file contains hidden or 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
import hoistStatics from 'hoist-non-react-statics'; | |
import React from 'react'; | |
/** | |
* Allows two animation frames to complete to allow other components to update | |
* and re-render before mounting and rendering an expensive `WrappedComponent`. | |
*/ | |
export default function deferComponentRender(WrappedComponent) { | |
class DeferredRenderWrapper extends React.Component { | |
constructor(props, context) { |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="[美团面试两列排序]"> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> |
This file contains hidden or 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
shell判断文件,目录是否存在或者具有权限 | |
#!/bin/sh | |
Path="/var/log/httpd/" | |
File="/var/log/httpd/access.log" | |
#这里的-x 参数判断$Path是否存在并且是否具有可执行权限 | |
if [ ! -x "$Path"]; then | |
mkdir "$Path" | |
fi |
This file contains hidden or 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
Scala NOTE | |
--- | |
#### **Spark执行方式** | |
- 命令行模式 | |
- spark-shell | |
- pyspark | |
- 脚本运行 | |
- spark-submit user-script |
This file contains hidden or 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
|接口|URL|参数|返回|备注| | |
|-|-|-|-| | |
|发送验证码|/api/code|mobile|JSON|0新用户注册 1重置密码| | |
|用户注册|/api/sign-up|mobile,nickname,password,code|JSON| | |
|用户登录|/api/sign-in|mobile,password|JSON| | |
|修改密码|/api/password-update|uid,mobile,old_password,new_password|JSON| | |
|名医列表|/api/doctor-list|page,pagesize|JSON| | |
|创建问题(瓶子)|/api/question-create|uid,title,age,duration|JSON|| | |
|问题列表|/api/question-list|uid,type,page,pagesize|JSON|type 1他人问题2我的问题| |