-
- 更好的系统通常是更小,更简单的系统
- 要设计健康的系统,请分而治之。将问题分成较小的部分
- 分而治之的工作是递归的:将系统分为更简单的子系统和组件的层次结构
- 告诉您的应用过去的工作尤为重要,因此请确保其可审核
-
- 当心炒作或时髦的技术,随着时间的流逝,计算机科学和工程学的基础不会发生太大变化
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 parseUrl(url) { | |
var a = document.createElement('a'); | |
a.href = url; | |
return { | |
source: url, | |
protocol: a.protocol.replace(':',''), | |
host: a.hostname, | |
port: a.port, | |
query: a.search, | |
params: (function(){ |
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
const array = [1,23,124,23,4,1.423,4,123,222,111,22,23]; | |
[...new Set(array)] | |
array.filter((item,index)=>array.indexOf(item) === index) | |
array.reduce((unique,item) => unique.includes(item) ? unique: [...unique,item],[]) |
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
'11111111111'.replace(/^(...)(....)/g,'$1-$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
#!/usr/bin/env bash | |
# 1. 版本号每次自增; | |
# 2. 区分测试和生产 package.json.test, package.json.prod | |
# 3. 发布到生产前会二次确认 | |
srcName='package.json.test' | |
if [[ $1 == "prod" ]] | |
then | |
srcName='package.json.prod' | |
read -p "Are you sure to publish to PRODUCTION? [Y/N]" -n 1 -r | |
echo "" |
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
export const assign = Object.assign || function (target, ...args) { | |
target = Object(target); | |
for (let i = 0; i < args.length; i++) { | |
const source = args[i]; | |
if (source !== null) { | |
for (const key in source) { | |
if (hasOwn(source, key)) { | |
target[key] = source[key]; | |
} | |
} |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body></body> | |
<script type="text/javascript"> | |
/* 无需显式的比较ID是否相等实现数据的对应格式化 */ | |
var friends = { items: [{ user_id: 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>jsonp请求测试</title> | |
</head> | |
<body> |
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 formatDate(date, formatStr) { | |
if (/(Y+)/.test(formatStr)) { | |
formatStr = formatStr.replace( | |
RegExp.$1, | |
(date.getFullYear() + '').substr(4 - RegExp.$1.length) | |
) | |
// 返回年 :'2016-mm-dd', 'hh:mm' | |
} | |
// 定义通用的匹配模式 | |
let o = { |
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
html,body{height:100%;} | |
html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,caption,th,td,form,fieldset,legend,input,button,textarea,menu{margin:0;padding:0;} | |
header,footer,section,article,aside,nav,hgroup,address,figure,figcaption,menu,details{display:block;} | |
table{border-collapse:collapse;border-spacing:0;} | |
caption,th{text-align:left;font-weight:normal;} | |
html,body,fieldset,img,iframe,abbr{border:0;} | |
i,cite,em,var,address,dfn{font-style:normal;} | |
[hidefocus],summary{outline:0;} | |
li{list-style:none;} | |
h1,h2,h3,h4,h5,h6,small{font-size:100%;} |
NewerOlder