update
This commit is contained in:
parent
fdf14922c3
commit
ab91634327
@ -74,4 +74,5 @@
|
||||
* 数据
|
||||
* 模型
|
||||
* 高性能的运算
|
||||
* 客户的努力
|
||||
* 客户的努力
|
||||
#
|
@ -55,4 +55,48 @@ function getScroll(){
|
||||
left:window.PageXoffset || document.body.scrollLeft || document.documentElement.scrollLeft || 0,
|
||||
top:window.PageYoffset || document.body.scrollTop || document.documentElement.scrollTop || 0
|
||||
}
|
||||
}
|
||||
|
||||
function setNumIterator() {
|
||||
if(!Number.prototype[Symbol.iterator]) {
|
||||
Object.defineProperty(
|
||||
Number.prototype,
|
||||
Symbol.iterator,
|
||||
{
|
||||
writable: true,
|
||||
configurable:true,
|
||||
enumerable: false,
|
||||
value: function iterator(){
|
||||
var i, inc, done = false, top = +this;
|
||||
// 正向迭代还是反向迭代?
|
||||
inc = 1 * (top < 0 ? -1 : 1);
|
||||
return {
|
||||
// 使迭代器本身成为iterable
|
||||
[Symbol.iterator](){return this;},
|
||||
next() {
|
||||
if(!done) {
|
||||
// 初始迭代总是0
|
||||
if(i == null) {
|
||||
i = 0
|
||||
}
|
||||
// 正向迭代
|
||||
else if(top >= 0) {
|
||||
i = Math.min(top, i + inc);
|
||||
}
|
||||
// 反向迭代
|
||||
else {
|
||||
i = Math.max(top, i + inc);
|
||||
}
|
||||
// 本次迭代后结束?
|
||||
if (i == top) done = true;
|
||||
return {value: i, done: flase};
|
||||
} else {
|
||||
return {done: true};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
@ -91,4 +91,26 @@
|
||||
* `var snowman = '\u2603'` \u转义
|
||||
* `var gclef = '\uD834\uDD1E'` 替代对
|
||||
* `var gclef = '\u{1D11E}'` 码点转义
|
||||
*
|
||||
* 精确判断字符串长度
|
||||
* `[...str].length`
|
||||
* `Array.from(str).length`
|
||||
* 符号`symbol`
|
||||
* 例子`var sym = Symbol('something')`
|
||||
* 不应该使用new
|
||||
* 使用typeof识别
|
||||
* 获取全局符号(如果全局不存在则新建一个放在全局)`Symbol.for("exec.name")`
|
||||
* 通过符号获取字符串`Symbol.keyFor(sym)`
|
||||
* 设置为对象的属性之后不可枚举,但是可以通过`Object.getOwnPropertySymbols(sym)`获取
|
||||
* 迭代器
|
||||
* 可以用来满足消费者生产者模型
|
||||
* 必须拥有一个next()
|
||||
* 可选return()用于消费者向生产者发送所有消费过程完成的信号,生产者应进行销毁程序
|
||||
* 可选throw()用于向生产者发送错误信号,终止生产
|
||||
* for of 可以消费迭代器,使用break退出会触发return
|
||||
* 通过rest/gather运算符可以消耗迭代器`it = arr[Symbol.iterator]() var [x, y] = it; var [z, ...w] = it;` it最终会被消耗光
|
||||
* 生成器
|
||||
* `function *foo() {yield 1;} it = foo() it.next() // value 1 ` next里边的参数会替换掉 yield后边的东西
|
||||
* 就是用迭代器来控制生成器
|
||||
* 可以用throw()配合try catch实现错误的双向或 内外双向传递
|
||||
* 每次被调用的时候都会是一个新的生成器
|
||||
* 加*
|
@ -75,9 +75,12 @@ db.auth("apiwx", "srVgEGwTf4")
|
||||
|
||||
// pi
|
||||
db.addUser('ccb', 'srVgEGwTf4')
|
||||
db.addUser('coc', 'qlSfefSor5')
|
||||
db.addUser('test', 'srVgEGwTf4')
|
||||
db.auth("ccb", "srVgEGwTf4")
|
||||
db.auth("test", "srVgEGwTf4")
|
||||
|
||||
|
||||
```
|
||||
|
||||
### 显示所有数据库
|
||||
|
@ -108,6 +108,49 @@ server {
|
||||
access_log /home/pi/data/nginx/logs/pi443.log;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name cloud.canary.moe;
|
||||
return 301 https://cloud.canary.moe$request_uri;
|
||||
access_log /home/pi/data/nginx/logs/cloud.log;
|
||||
}
|
||||
|
||||
server {
|
||||
#SSL 访问端口号为 443
|
||||
listen 443 ssl http2; #填写绑定证书的域名
|
||||
server_name cloud.canary.moe;
|
||||
#证书文件名称
|
||||
ssl_certificate 1_cloud.canary.moe_bundle.crt;
|
||||
#私钥文件名称
|
||||
ssl_certificate_key 2_cloud.canary.moe.key;
|
||||
ssl_session_timeout 5m;
|
||||
#请按照这个协议配置
|
||||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
add_header Strict-Transport-Security "max-age=31536000";
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
|
||||
ssl_prefer_server_ciphers on;
|
||||
location / {
|
||||
proxy_pass http://0.0.0.0:5299;
|
||||
proxy_http_version 1.1;
|
||||
proxy_read_timeout 360s;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host:$server_port;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
location /download {
|
||||
alias /home/pi/data/baiducloud/Downloads/340047113_1144131090;
|
||||
autoindex on;
|
||||
autoindex_exact_size off;
|
||||
autoindex_localtime on;
|
||||
autoindex_format html;
|
||||
charset utf-8,gbk;
|
||||
}
|
||||
access_log /home/pi/data/nginx/logs/cloud443.log;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name coc.canary.moe;
|
||||
@ -165,7 +208,7 @@ server {
|
||||
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4:!DH:!DHE;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
root /home/pi/data/owncloud;
|
||||
root /home/pi/data/nextcloud/nextcloud;
|
||||
index index.php index.htm;
|
||||
client_max_body_size 10G;
|
||||
fastcgi_buffers 64 4K;
|
||||
@ -234,4 +277,4 @@ server {
|
||||
proxy_pass http://127.0.0.1:5006;
|
||||
}
|
||||
access_log /home/pi/data/nginx/logs/portainer443.log;
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,48 @@
|
||||
var snowman = '\u2603' console.log(snowman)
|
||||
function setNumIterator() {
|
||||
if(!Number.prototype[Symbol.iterator]) {
|
||||
Object.defineProperty(
|
||||
Number.prototype,
|
||||
Symbol.iterator,
|
||||
{
|
||||
writable: true,
|
||||
configurable:true,
|
||||
enumerable: false,
|
||||
value: function iterator(){
|
||||
var i, inc, done = false, top = +this;
|
||||
// 正向迭代还是反向迭代?
|
||||
inc = 1 * (top < 0 ? -1 : 1);
|
||||
console.log(top)
|
||||
return {
|
||||
// 使迭代器本身成为iterable
|
||||
[Symbol.iterator](){return this;},
|
||||
next() {
|
||||
if(!done) {
|
||||
// 初始迭代总是0
|
||||
if(i == null) {
|
||||
i = 0
|
||||
}
|
||||
// 正向迭代
|
||||
else if(top >= 0) {
|
||||
i = Math.min(top, i + inc);
|
||||
}
|
||||
// 反向迭代
|
||||
else {
|
||||
i = Math.max(top, i + inc);
|
||||
}
|
||||
// 本次迭代后结束?
|
||||
if (i == top) done = true;
|
||||
return {value: i, done: false};
|
||||
} else {
|
||||
return {done: true};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
setNumIterator()
|
||||
for (var i of 3) {
|
||||
console.log(i)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user