billfeller
billfeller
https://en.wikipedia.org/wiki/Cross-origin_resource_sharing The CORS (**Cross-origin resource sharing**) standard describes new HTTP headers which provide browsers and servers a way to request remote URLs only when they have permission. Although some validation...
转自:[Think in React](https://discountry.github.io/react/docs/thinking-in-react.html) **判断数据是 props or state 的三条规则:** 让我们来看看每一条,找出哪一个是 state。每个数据只要考虑三个问题: 它是通过 props 从父级传来的吗?如果是,他可能不是 state。 它随着时间推移不变吗?如果是,它可能不是 state。 你能够根据组件中任何其他的 state 或 props 把它计算出来吗?如果是,它不是 state。
## 通过 window.name+iframe 实现跨域解决方案 ### 原理 问题:如何通过 window.name+iframe 在 a.com/index.html 获取 b.com 下的资源 通过 http://a.com/index.html 设置 iframe.src="http://b.com/proxy.html" 获取跨域资源值,将其赋值保存于 window.name 中,然后设置 iframe.src = "http://a.com/blank.html" 指向 a.com 下的空白页,由于刷新 iframe 页面并不会改变 iframe 下...
原文链接:[异步流程控制](https://github.com/i5ting/stuq-koa/blob/master/koa-getting-start/async.md) # 异步流程控制 主要讲3个 - Promise - Generator/yield - Async/await # Promise/a+规范 顺序执行的代码和错误有限的回调方式都是js引擎默认支持的,这部分大家会调用接口,无太多变化,而Promise是对callback的思考,或者说改良方案,目前使用非常普遍,这里详细讲解一下。 ## node里的Promise promise最早是在commonjs社区提出来的,当时提出了很多规范。比较接受的是promise/A规范。后来人们在这个基础上。提出了promise/A+规范,也就是实际上的业内推行的规范。es6也是采用的这种规范。 > The Promise object is used for asynchronous computations. A Promise represents an operation...
原文链接:[HTTP 协议中的 Transfer-Encoding](https://imququ.com/post/transfer-encoding-header-in-http.html) # HTTP 协议中的 Transfer-Encoding 本文作为我的博客「[HTTP 相关](https://imququ.com/series.html#toc-7)」专题新的一篇,主要讨论 HTTP 协议中的 Transfer-Encoding。这个专题我会根据自己的理解,以尽量通俗的讲述,结合代码示例和实际场景来说明问题,欢迎大家关注和留言交流。 Transfer-Encoding,是一个 HTTP 头部字段,字面意思是「传输编码」。实际上,HTTP 协议中还有另外一个头部与编码有关:Content-Encoding(内容编码)。Content-Encoding 通常用于对实体内容进行压缩编码,目的是优化传输,例如用 gzip 压缩文本文件,能大幅减小体积。内容编码通常是选择性的,例如 jpg / png 这类文件一般不开启,因为图片格式已经是高度压缩过的,再压一遍没什么效果不说还浪费 CPU。 而 Transfer-Encoding 则是用来改变报文格式,它不但不会减少实体内容传输大小,甚至还会使传输变大,那它的作用是什么呢?本文接下来主要就是讲这个。我们先记住一点,Content-Encoding 和 Transfer-Encoding 二者是相辅相成的,对于一个...
### 本质区别 根本区别在于 attribute vs property 的区别: 1). attribute 是通过 Element.getAttribute / Element.setAttribute 方法调用的,即元素标签上设置的属性值,如 checked="true"; 2). property 是通过访问 Element 的属性值 property 来获取或设置的,即DOM Element对象的属性值; 示例: ```html attribute vs property var checkbox...
### 区别: 1. npm-shrinwkrap.json 可以被包含到发布包,而 package-lock.json 不行,保证用户可以自由管理依赖包; 2. 如果 package-lock.json 和 npm-shrinwkrap.json 同时存在于项目目录中,package-lock.json 将被忽略; ### 结论: package-lock.json 兼容 npm-shrinkwrap.json 数据结构,由于 npm-shrinkwrap.json 从来没有被正式推荐使用过,**建议直接使用 package-lock.json 来实现 依赖库 加锁,保证环境一致性目的。** ### 推荐阅读 1. [npm-shrinkwrap.json](https://docs.npmjs.com/files/shrinkwrap.json)...
对计算结果做缓存,避免频繁全表扫描操作
1. [ImageMagick][1] 2. [command-line-options英文帮助文档][2] 3. [ImageMagick/ImageMagick Convert命令中文帮助.md][3] 4. [The Anatomy of the Command-line][4] [1]: http://www.imagemagick.org/script/index.php [2]: http://www.imagemagick.org/script/command-line-options.php [3]: https://github.com/ohmycloud/ImageMagick/blob/master/ImageMagick%20Convert%E5%91%BD%E4%BB%A4%E4%B8%AD%E6%96%87%E5%B8%AE%E5%8A%A9.md [4]: https://www.imagemagick.org/script/command-line-processing.php
1. APNG 2. JPEG XR 3. WebP:A new image format for the Web By Google https://developers.google.com/speed/webp/ https://isux.tencent.com/introduction-of-webp.html 4. sharpP:sharpP是腾讯音视频实验室推出的一种图片压缩技术。sharpP基于新一代视频压缩编码标准HEVC(也就是H.265),压缩效率相对其他图片格式具有明显优势,是业界领先的图片压缩技术。 https://www.qcloud.com/community/article/164816001481011868 TBS 2.2 X5内核,新增SharpP图片格式支持, 图片压缩优于WebP,目前广泛应用于腾讯客户端软件,弊端就是受限iOS平台由于系统对webview内核的限制,无法很好的嵌入sharpP组件,未能支持sharpp解码。需要客户端集成sharpP编解码器; https://developer.apple.com/app-store/review/guidelines/  5. wxHEPC 6. Guetzli...