YSC 的频道
#WSL 中使用 npm 可能会遇到 syscall rename EACCESS 的问题,可以使用 wslunpindir 来解决。
这个问题我没遇到过,npm 更经常遇到的问题是
几种解决方案官方已经写清楚了,可以自己查阅(嫌麻烦也可以直接
Resolving EACCES permissions errors when installing packages globally
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
npm install -g 时的 EACCES permissions errors 几种解决方案官方已经写清楚了,可以自己查阅(嫌麻烦也可以直接
sudo 但是不推荐Resolving EACCES permissions errors when installing packages globally
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
#js
safari 为了防止网站骚扰用户,限制
因此一些点击后需要先获取地址再跳转的场景(如支付需要先请求后端生成订单)在safari下就比较僵硬了
解决方案
比较简单的,可以引导用户允许弹出窗口,或者提前把异步操作做完
不过,今天的重点是找到的一个很酷的解决方案
https://stackoverflow.com/questions/20696041/window-openurl-blank-not-working-on-imac-safari
window.open 弹窗safari 为了防止网站骚扰用户,限制
window.open() 必须在用户点击的同一个事件循环内(event loop)(chrome 也有类似的策略但限制比较松),否则会被拦截因此一些点击后需要先获取地址再跳转的场景(如支付需要先请求后端生成订单)在safari下就比较僵硬了
解决方案
比较简单的,可以引导用户允许弹出窗口,或者提前把异步操作做完
不过,今天的重点是找到的一个很酷的解决方案
https://stackoverflow.com/questions/20696041/window-openurl-blank-not-working-on-imac-safari
#js
用于混淆代码的一个手段
利用
压缩后的代码是没有换行的,利用这个特点可以判断代码是否(正在)被修改
思路来源
https://www.v2ex.com/t/597018
用于混淆代码的一个手段
利用
Function 的 toString 检测代码是否被格式化过// 随便定义一个函数
const f = function() {
return true
}
---
console.log(f)
"function() {
return true
}"
压缩后的代码是没有换行的,利用这个特点可以判断代码是否(正在)被修改
思路来源
https://www.v2ex.com/t/597018
#js #react
React v16.9.0 为 javascript: URLs 显示警告后使用以下写法的程序员有点难受
<a href="javascript:void(0)">Safe Link</a>
比较简单的替代方案是使用如下写法
<a href='#' onClick={e => e.preventDefault()}>
吃瓜地址
https://github.com/facebook/react/issues/16382
React v16.9.0 为 javascript: URLs 显示警告后使用以下写法的程序员有点难受
<a href="javascript:void(0)">Safe Link</a>
比较简单的替代方案是使用如下写法
<a href='#' onClick={e => e.preventDefault()}>
吃瓜地址
https://github.com/facebook/react/issues/16382
GitHub
False-positive security precaution warning (`javascript:` URLs) · Issue #16382 · facebook/react
Do you want to request a feature or report a bug? Report a bug. What is the current behavior? React 16.9.0 deprecates javascript: URLs (@sebmarkbage in #15047). It was motivated by preventing XSS v...
Forwarded from rxliuli
程序员,不要急于学习编程语言,先学会如何解决问题-InfoQ
https://www.infoq.cn/article/kRRB*FUJpRivjME95aCe
https://www.infoq.cn/article/kRRB*FUJpRivjME95aCe
www.infoq.cn
程序员,不要急于学习编程语言,先学会如何解决问题-InfoQ
这是一篇关于虚度青春的短篇回忆录。多年来,我一直在学习编程语言,然后用它们来构建更好的投资工具。在建立预测和风险管理模型之余,编程方面的工作堆积如山。但实际上,我并没有花太多时间在真正需要解决的问题上。我把大部分注意力放在了算法和编程语言上。多年来,我每周都要花几个小时学习计算机基础知识,却没有花太多时间应用这些知识来让现实世界变得更美好。而我的一个朋友却基于微软Office开发出了一个完整的产品
#js #vue
通过在写一个的vnode组件的方式简单地在 vue 实现渲染属性
https://stackoverflow.com/questions/49352525/can-you-render-vnodes-in-a-vue-template
通过在写一个的vnode组件的方式简单地在 vue 实现渲染属性
<div>
<vnode :vnode="value"/>
</div>
{
components: {
Vnode: {
functional: true,
render: (h, ctx) => ctx.props.vnode
}
},
props: ['value']
}
https://stackoverflow.com/questions/49352525/can-you-render-vnodes-in-a-vue-template
#ts
styled-components 的 type 包
解决方案(都不太好
1. 降级使用
围观地址(半年了还没修QAQ
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33311
styled-components 的 type 包
@types/styled-components 在 v.4.1.9 依赖了 @types/react-native ,导致全局类型冲突,结果就是使用了这个包的大部分项目 tsc 会打出 19 个类型冲突的错误解决方案(都不太好
1. 降级使用
@types/styled-components@v4.1.8
2. tsconfig设置 types 手动指定类型目录围观地址(半年了还没修QAQ
https://github.com/DefinitelyTyped/DefinitelyTyped/issues/33311
GitHub
node_modules/@types/react-native/globals.d.ts (36,15): Duplicate identifier 'FormData'. · Issue #33311 · DefinitelyTyped/DefinitelyTyped
If you know how to fix the issue, make a pull request instead. I tried using the @types/styled-components package and had problems because since of v.4.1.9 another conflicted dependency was added (...