Skip to content

Instantly share code, notes, and snippets.

@Reedef
Reedef / nn_api
Last active August 29, 2015 14:24
暖暖项目
|接口|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我的问题|
@Reedef
Reedef / Scala Note
Created June 30, 2015 16:43
Scala笔记
Scala NOTE
---
#### **Spark执行方式**
- 命令行模式
- spark-shell
- pyspark
- 脚本运行
- spark-submit user-script
@Reedef
Reedef / file_path_test.sh
Last active December 8, 2015 02:47 — forked from feng-ming/file_path_test.sh
unix shell 判断目录/文件是否存在, 以及是否有读写权限。
shell判断文件,目录是否存在或者具有权限
#!/bin/sh
Path="/var/log/httpd/"
File="/var/log/httpd/access.log"
#这里的-x 参数判断$Path是否存在并且是否具有可执行权限
if [ ! -x "$Path"]; then
mkdir "$Path"
fi
@Reedef
Reedef / index.html
Created September 21, 2016 00:08 — forked from anonymous/index.html
JS Bin [美团面试两列排序] // source https://jsbin.com/mejapis
<!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>
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) {
@Reedef
Reedef / InitArray.js
Created May 15, 2017 07:38
Init empty Array width default value
function range(len){
return Array.apply(null, Array(len)).map(function (v,k) { return k });
}
// Learnd From @石濑
// Fetch Data
const request = new Promise(function(resolve, reject) {
fetch(
sth,
success => resolve('data'),
fail=> reject('reason')
);
})
function copyToClipboard(element) {
var $temp = $("<textarea></textarea>");
$("body").append($temp);
$temp.text("aaaa").select();
document.execCommand("copy");
$temp.remove();
}
@Reedef
Reedef / getValue.js
Last active October 25, 2020 14:13
链式获取数据
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;
};
@Reedef
Reedef / uuid.js
Created January 3, 2024 02:52 — forked from chhpt/uuid.js
生成 uuid
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())