Skip to content

Commit 23bbaff

Browse files
authored
Merge pull request #38 from mmdapl/docs/delete
chore: 清理manuscripts手稿目录
2 parents 37b0445 + ebe8d6a commit 23bbaff

39 files changed

+981
-7
lines changed

code/node/lodash/demo-array.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Lodash数组相关操作
3+
* @private
4+
*/
5+
6+
const _ = require('lodash')
7+
8+
9+
// chunk: 分片 ,指定长度切割
10+
console.log(_.chunk(['a', 'b', 'c', 'd'], 2))
11+
// => [['a', 'b'], ['c', 'd']]
12+
console.log(_.chunk(['a', 'b', 'c', 'd'], 3))
13+
// => [['a', 'b', 'c'], ['d']]
14+
15+
16+
// compact: 过滤假值(false, null,0, "", undefined,NaN)
17+
// concat: 拼接
18+
// difference: 过滤给定数组中的值(来源于数组)
19+
// drop: 创建切片数组
20+
// fill: 指定元素填充
21+
// head: 获取头部元素
22+
// last:获取尾部元素
23+
// indexOf:查找目标元素第一个索引
24+
// lastIndexOf: 查找目标元素最后一个索引
25+
// initial:排除最后一个元素
26+
// intersection: 查找多数组的交集元素
27+
// join: 指定符号连接数组元素
28+
// nth: 返回数组的第n个元素
29+
// pull:移除数组中所有和给定值相等的元素
30+
// remove:移除元素
31+
// reverse:元素反转
32+
// slice: 指定索引裁剪元素
33+
// sortedIndex:排序插入返回索引
34+
// tail:去除第一个元素
35+
// take:提取元素(指定个数)
36+
// union: 创建一个按顺序排列的唯一值的数组
37+
// uniq: 数组去重,第一次出现的元素保留
38+
// without: 提出所有给定值,返回新数组
39+
// xor: 创建给点数组唯一值的数组
40+
// zip: 创建一个分组元素的数组,数组的第一个元素包含所有给定数组的第一个元素,数组的第二个元素包含所有给定数组的第二个元素,以此类推

code/node/lodash/demo-num.js

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/**
2+
* Lodash数字相关操作
3+
* @private
4+
*/
5+
6+
const _ = require('lodash')
7+
8+
// inRange: 判断是否在范围中
9+
console.log(_.inRange(3, 2, 4))
10+
// => true
11+
console.log(_.inRange(4, 8))
12+
// => true
13+
console.log(_.inRange(4, 2))
14+
// => false
15+
console.log(_.inRange(2, 2))
16+
// => false
17+
console.log(_.inRange(1.2, 2))
18+
// => true
19+
console.log(_.inRange(5.2, 4))
20+
// => false
21+
console.log(_.inRange(-3, -2, -6))
22+
// => true
23+
24+
25+
// random: 返回指定范围随机值
26+
console.log(_.random(0, 5))
27+
// => an integer between 0 and 5
28+
console.log(_.random(5))
29+
// => also an integer between 0 and 5
30+
console.log(_.random(5, true))
31+
// => a floating-point number between 0 and 5
32+
console.log(_.random(1.2, 5.2))
33+
// => a floating-point number between 1.2 and 5.2
34+
35+
// add : 相加
36+
console.log(_.add(6, 4))
37+
// => 10
38+
39+
40+
// divide: 相除
41+
console.log(_.divide(6, 4))
42+
// => 1.5
43+
44+
45+
// multiply: 相乘
46+
console.log(_.multiply(6, 4))
47+
// => 24
48+
49+
50+
// subtract: 相减
51+
_.subtract(6, 4)
52+
// => 2
53+
54+
// sum: 求和
55+
_.sum([4, 2, 8, 6])
56+
// => 20
57+
58+
59+
// ceil: 向上取整
60+
console.log(_.ceil(4.006))
61+
// => 5
62+
console.log(_.ceil(6.004, 2))
63+
// => 6.01
64+
console.log(_.ceil(6040, -2))
65+
// => 6100
66+
67+
// floor: 向下取整
68+
console.log(_.floor(4.006))
69+
// => 4
70+
console.log(_.floor(0.046, 2))
71+
// => 0.04
72+
console.log(_.floor(4060, -2))
73+
// => 4000
74+
75+
76+
// round: 四舍五入
77+
console.log(_.round(4.006))
78+
// => 4
79+
console.log(_.round(4.006, 2))
80+
// => 4.01
81+
console.log(_.round(4060, -2))
82+
// => 4100
83+
84+
85+
// max: 最大值
86+
console.log(_.max([4, 2, 8, 6]))
87+
// => 8
88+
console.log(_.max([]))
89+
// => undefined
90+
91+
92+
// mean: 求平均值
93+
console.log(_.mean([4, 2, 8, 6]))
94+
// => 5
95+
96+
97+
// min: 最小值
98+
console.log(_.min([4, 2, 8, 6]))
99+
// => 2
100+
console.log(_.min([]))
101+
// => undefined

code/node/lodash/demo-object.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Lodash对象相关操作
3+
* @private
4+
*/
5+
6+
7+
const _ = require('lodash')
8+
9+
10+
// assign:拷贝
11+
// merge: 深拷贝
12+
// at: 创建数组,值来源于对象路径相应的值
13+
// create: 创建对象,继承prototype
14+
// defaults: 分配来源对象的可枚举属性到目标对象所有解析为 undefined 的属性上【不覆盖】
15+
// findKey: 返回存在值对应的key
16+
// forIn: 迭代器遍历对象的自身和继承的可枚举属性
17+
// forOwn:迭代器遍历对象的自身的可枚举属性
18+
// functions: 创建一个函数属性名称的数组,函数属性名称来自object对象自身可枚举属性
19+
// get: 指定路径获取对象值
20+
// result: 累死get ,指定属性值操作
21+
// has: 检查直接属性是否存在
22+
// invert: 键值互换
23+
// invoke: 调用对象中属性值函数(支持传参)
24+
// keys: 对象属性组成的数组
25+
// mapKeys: 自定义属性,生成新对象
26+
// mapValues: 自定义值,生成新对象
27+
// pick:指定属性,返回新对象
28+
// omit: 指定属性反选,返回新对象
29+
// set: 设置对象属性和值
30+
// update: 类似set操作
31+
// unset: 移除对象属性
32+
// toPairs: 创建可枚举属性的对象键值数组(二维),与fromPairs操作相反
33+
// transform: reduce替代方法,值、键转换
34+
// values: 创建对象可枚举属性值的数组

code/node/lodash/demo-set.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Lodash集合相关操作
3+
* @private
4+
*/
5+
6+
const _ = require('lodash')
7+
8+
// countBy: 计数
9+
console.log(_.countBy([6.1, 4.2, 6.3], Math.floor))
10+
// => { '4': 1, '6': 2 }
11+
// The `_.property` iteratee shorthand.
12+
console.log(_.countBy(['one', 'two', 'three'], 'length'))
13+
// => { '3': 2, '5': 1 }
14+
15+
16+
// each: 遍历
17+
// forEach: 遍历
18+
_([1, 2]).forEach(function(value) {
19+
console.log(value)
20+
})
21+
// => Logs `1` then `2`.
22+
_.forEach({ a: 1, b: 2 }, function(value, key) {
23+
console.log(key)
24+
})
25+
// => Logs 'a' then 'b' (iteration order is not guaranteed).
26+
27+
28+
// every:断言,返回true|false
29+
_.every([true, 1, null, 'yes'], Boolean)
30+
// => false
31+
const users = [
32+
{ user: 'barney', age: 36, active: false },
33+
{ user: 'fred', age: 40, active: false }
34+
]
35+
// The `_.matches` iteratee shorthand.
36+
console.log(_.every(users, { user: 'barney', active: false }))
37+
// => false
38+
// The `_.matchesProperty` iteratee shorthand.
39+
console.log(_.every(users, ['active', false]))
40+
// => true
41+
// The `_.property` iteratee shorthand.
42+
console.log(_.every(users, 'active'))
43+
// => false
44+
45+
46+
// filter: 过滤
47+
const userList = [
48+
{ user: 'barney', age: 36, active: true },
49+
{ user: 'fred', age: 40, active: false }
50+
]
51+
console.log(_.filter(userList, function(o) { return !o.active }))
52+
// => objects for ['fred']
53+
// The `_.matches` iteratee shorthand.
54+
console.log(_.filter(userList, { age: 36, active: true }))
55+
// => objects for ['barney']
56+
// The `_.matchesProperty` iteratee shorthand.
57+
console.log(_.filter(userList, ['active', false]))
58+
// => objects for ['fred']
59+
// The `_.property` iteratee shorthand.
60+
console.log(_.filter(userList, 'active'))
61+
// => objects for ['barney']
62+
63+
// reject: filter反方法,过滤非真值
64+
65+
66+
// find: 查询
67+
// groupBy : 分组
68+
// includes: 包含
69+
// keyBy:迭代函数遍历,创建一个对象组成
70+
// map: 迭代函数遍历,返回数组
71+
// orderBy: 指定迭代函数进行排序
72+
// partition:创建一个分成两组的元素数组
73+
// reduce: 通过迭代函数遍历
74+
// sample: 集合中获取随机值
75+
// shuffle: 集合元素随机打乱
76+
// size: 返回集合的长度,支持类数组、字符串、对象
77+
// some: 筛选,判断是否存在,返回true|false
78+
// sortBy: 创建元素数组,迭代函数处理结果升序排序

code/node/lodash/demo-string.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* lodash字符串相关操作
3+
* @private
4+
*/
5+
6+
7+
const _ = require('lodash')
8+
9+
// camelCase: 小驼峰
10+
// kebabCase: 转换为-连接,例如:Foo Bar ----> foo-bar
11+
// snakeCase: 转化为蛇形风格
12+
// capitalize: 首字母大写
13+
// lowerFirst: 首字母小写
14+
// upperFirst:首字母转为大写
15+
// endsWith: 判断结尾字符
16+
// startsWith: 判断开头字符
17+
// escape: 字符转义处理, 与unescape相反
18+
// lowerCase: 空格分开单词,并转换为小写
19+
// upperCase: 空格分隔单词,并转换为大写
20+
// pad: 字符填充为指定长度
21+
// repeat: 字符串重复
22+
// replace: 字符替换
23+
// split: 切割拆分
24+
// toLower: 全部转换为小写
25+
// toUpper: 全部转换为大写
26+
// trim: 移除前面和后面的 空格 或 指定的字符
27+
// words: 拆分词为数组

docs/manuscript/good-idea.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
# 好的想法
3+
4+
### 网站置灰
5+
6+
```css
7+
/* -webkit-filter css滤镜 */
8+
html.gray-mode { filter: grayscale(.95); -webkit-filter: grayscale(.95); }
9+
```
10+
- blur 模糊-webkit-filter:blur(2px);
11+
- brightness 亮度-webkit-filter:brightness(25%);
12+
- contrast 对比度-webkit-filter: contrast(50%);
13+
- drop-shadow 阴影-webkit-filter: drop-shadow(5px 5px 5px rgba(0, 0, 0, 0.5));
14+
- opacity 透明度-webkit-filter: opacity(50%);
15+
- grayscale 灰度-webkit-filter: grayscale(80%);
16+
- sepia 褐色-webkit-filter: sepia(100%);
17+
- invert 反色-webkit-filter: invert(100%);
18+
- hue-rotate 色相旋转-webkit-filter:hue-rotate(180deg);
19+
- saturate 饱和度-webkit-filter: saturate(1000%);

docs/manuscript/server-end/build-website/nginx-gzip.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
2-
3-
41
# 配置gzip
52

63
> nginx返回js文件的时候,会判断是否开启gzip,然后压缩后再还给浏览器。但是nginx其实会先判断是否有.gz后缀的相同文件,有的话直接返回,nginx自己不再进行压缩处理。而压缩是要时间的!不同级别的压缩率花的时间也不一样。所以提前准备gz文件,可以更加优化。而且你可以把压缩率提高点,这样带宽消耗会更小
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11

2-
## SSL证书配置
2+
# SSL证书配置
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# ES6

0 commit comments

Comments
 (0)