Coder Social home page Coder Social logo

笔记 about blog HOT 8 OPEN

rottenpen avatar rottenpen commented on June 12, 2024
笔记

from blog.

Comments (8)

rottenpen avatar rottenpen commented on June 12, 2024

HTTPS 并非绝对安全,掌握根证书的机构、掌握加密算法的组织同样可以进行中间人形式的攻击。

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

MVVM: VM 在 UI 层之下。VM 为 view 暴露数据和方法,VM 推送数据到在它之下的 model。
MVP:controller 替换为 presenter。presenter 与 view 平起平坐。presenter 监听 view 和 model 的事件,作为中间人在他们之间调解两边的事件,辅助两边交流。
MVC:view 层在结构顶层,controller 在 view 之下。model 在 controller 之下。view 指向 controller,controller 指向 model。model 更改时 view 会得到提醒(这个情况是一个单向流)。

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

alter user 'root'@'localhost' identified by '123';
mysql 修改密码的命令行
旧版的 SET PASSWORD = PASSWORD('your new password'); 已经过期

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

Object 的 keys 可以通过中括号包裹的方式进行变量拼接:

const myPrefix = `prefix_`

const myObj = {
   [myPrefix + 'prop1'] : 'foo',
   [myPrefix + 'prop2'] : 'bar',
}
myObj.prefix_prop1   // returns 'foo'
myObj.prefix_prop2   // returns 'bar'

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

webpack cdn拓展配置

const cdn = [
   “https://cdn.bootcss.com/vue/2.5.21/vue.min.js”,
   “https://cdn.bootcss.com/vue-router/3.0.2/vue-router.min.js”
]
const externals = {
   'vue': 'Vue',
   ‘vue-router’: ‘VueRouter’
}
module.exports = {
   chainWebpack: config => { // 然后发现只有vue-cli3有这个属性
        。。。
   }
}

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

index.html 不缓存

<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">

但是 no-cache 只能保证 index.html 缓存会在请求之前判断资源是否有更新,如果服务器也有缓存,那么浏览器还是会继续用原来的缓存。所以我们需要在 index.html 的 header 处配置不缓存。

no-cache: 在释放缓存副本之前,强制高速缓存将请求提交给原始服务器进行验证。通过 eTag 判断资源是否更新。

no-store: 缓存不应存储有关客户端请求或服务器响应的任何内容。

ngnix 相关配置:

location = /index.html {
    add_header Cache-Control "no-cache, no-store";
}

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

sketch设计图的阴影转成 CSS 代码:

image

.shadow {
    shadow: 0 2px 6px rgba(0,0,0,0.15)
}

from blog.

rottenpen avatar rottenpen commented on June 12, 2024

随机数
Math.random
Math.random 返回一个具有正值的数字值,大于或等于0但小于1,使用一个依赖于实现的算法或策略随机或伪随机地选择,在该范围上具有近似均匀分布。此函数不接受参数。

   不同的引擎实现方式是不一样的。事实上,越来越多的浏览器开始采用 xorshift128+ 算法来最终实现生成随机数。
   V8引擎的最新的实现。它首先用散列 murmurhash3 算法,将系统时间散列成两个状态值,然后使用 xorshift128+ 最终生成随机数。
   实际上这种方法也是具有周期性的。
   blink 中 `Crypto.getRandomValues` 方法直接调用操作系统提供的随机数生成法。这个方法相对安全,不过效率会低于 `Math.random`。
(function() {
  var rng = window.crypto || window.msCrypto;
  if (rng === undefined){
    return
  }

  window.randomSafe = function() {
    return rng.getRandomValues(new Uint32Array(1))[0] / 0xFFFFFFFF;
  }
})()

from blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.