Skip to content

Commit

Permalink
feat: mysql and mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
awayjin committed Mar 25, 2020
1 parent ea7c01c commit eaafcd9
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
- refactor:重构(即不是新增功能,也不是修改bug的代码变动)
- test:增加测试
- chore:构建过程或辅助工具的变动


git branch -r

git checkout -b 本地分支名x origin/远程分支名x
25 changes: 25 additions & 0 deletions js/01.js-objects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## 进制转换

二进制转十进制,十进制转二进制

parseInt
```
["1", "2", "3"].map(parseInt);
答案:[1, NaN, NaN]
解析:parseInt (val, radix) :两个参数,val值,radix基数(就是多少进制转换)
map 能传进回调函数 3参数 (element, index, array)
parseInt('1', 0); //0代表10进制
parseInt('2', 1); //没有1进制,不合法
parseInt('3', 2); //2进制根本不会有3
巩固:["1", "1", "11","5"].map(parseInt) //[1, NaN, 3, NaN]
parseInt('13',2) // 1 ,
计算机在二进制只认识0,1,parseInt转换时就当作不认识的字符忽略了
parseInt('18str') //18 10进制能认识到9
parseInt(1/0,19) // 18
1/0 == Infinity 19 进制计算机能认识最后一个字符是i
详细解析在下面的链接
```



js 对象分类(https://time.geekbang.org/column/article/80011)
31 changes: 31 additions & 0 deletions js/Demo/10-reflex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Title</title>
</head>
<body>

<script>
class A {
methodA () {
this.properyA = 'a'
return 'methodA'
}
}

class B extends A {
constructor () {
super();
}
methodB () {
return 'methodB'
}
}

let b = new B()
</script>

</body>
</html>
56 changes: 56 additions & 0 deletions js/issue-log.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
## 1. vue:将px转化为rem,适配移动端vant-UI等框架(postcss-pxtorem)

(1)下载lib-flexible:
```
yarn add lib-flexible
```

(2)引入 lib-flexible:
在main.js中引入lib-flexible
```
import 'lib-flexible/flexible'
```

(3).设置meta标签
```
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
```

(4).安装postcss-pxtorem
```
yarn add postcss-pxtorem
```

(5) 配置 postcss-pxtorem
browsers 改为 overrideBrowserslist
```
module.exports = {
plugins: {
//...
'autoprefixer': {
// vant 官方的配置有问题
// browsers: ['Android >= 4.0', 'iOS >= 7'] // 修改前
overrideBrowserslist: ['Android >= 4.0', 'iOS >= 7'] // 修改后
},
'postcss-pxtorem': {
rootValue: 37.5, // vant-UI的官方根字体大小是37.5
propList: ['*']
}
}
}
```

可能 postcss-pxtorem 出现问题, 以上的解决方案:
```
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
```
23 changes: 23 additions & 0 deletions sql/base-tech/08.advanced-processing/08.advanced-processing.sql
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,28 @@ SELECT
FROM Product;


-- rollup
select
product_type, sum(sale_price), avg(sale_price)
FROM
product
GROUP BY product_type with rollup;

-- 将“登记日期”添加到聚合键当中
select product_type, regist_date, sum(sale_price)
FROM product
GROUP BY product_type, regist_date with ROLLUP;

SELECT * FROM product;












29 changes: 28 additions & 1 deletion sql/mongodb/01-production.md → sql/mongodb/01-02.production.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,31 @@ find 和 findOne 方法可以用于査询集合里的文档。
db.blog.update({ title: 'til'}, { title: '33til'})

4. 删除
db.blog.remove({ title: 'til'})
db.blog.remove({ title: 'til'})

## 2.6 数据类型

2.6.1 基本数据类型

在概念上, MongoDB 的文档与 JavaScript 中的对象相近,因而可认为它类似于JSON。

JSON 包含 6 种数据类型: null、布尔、 数字、字符串、数组和对象

MongoDB 在保留 JSON 基本键 / 值对特性的基础上,添加了其他一些数据类型。
- null
- 布尔型 true and false
- 数值 { x: 3.3, y: 4 }
- 字符串
- 日期
- 正则表达式 {"x" : /foobar/i}
- 数组
- 内嵌文档
- 文档可嵌套其他文档,被嵌套的文档作为父文档的值:
{"x" : {"foo" : "bar"}}
- 对象id
- 对象 id 是一个 12 字节的 ID,是文档的唯一标识。
"x" : ObjectId()}
- 二进制数据
- 代码
- 查询和文档中可以包括任意 JavaScript 代码:
{"x" : function() { /* ... */ }}

0 comments on commit eaafcd9

Please sign in to comment.