前端
关于类型数组 TypedArray
-
讲了 TypeScript 使用过程中经常犯的错误
25+ JavaScript Shorthand Coding Techniques
Math.floor
的简写是~~
eval
-
jsconst evalAlter = fn => {const Fn = Functionreturn new Fn('return' + fn)()}
Vue 函数式组件
-
- CSP 是什么:
CSP 的实质就是白名单制度,开发者明确告诉客户端,哪些外部资源可以加载和执行,等同于提供白名单。它的实现和执行全部由浏览器完成,开发者只需提供配置
- 设置方法:
- 在 http 头中声明
- 在 meta 标签中声明
- 具体配置中:
- 如果同一个限制选项使用多次,只有第一次会生效。
script-src
和object-src
是必设的,除非设置了default-src
。script-src
不能使用unsafe-inline
关键字(除非伴随一个nonce
值),也不能允许设置data:URL
。
- 补充阅读:
- CSP 是什么:
前端安全系列(一):如何防止 XSS 攻击? - 美团技术团队
严格的 CSP 在 XSS 的防范中可以起到以下的作用:
- 禁止加载外域代码,防止复杂的攻击逻辑。
- 禁止外域提交,网站被攻击后,用户的数据不会泄露到外域。
- 禁止内联脚本执行(规则较严格,目前发现 GitHub 使用)。
- 禁止未授权的脚本执行(新特性,Google Map 移动版在使用)。
- 合理使用上报可以及时发现 XSS,利于尽快修复问题。
-
浏览器在渲染 JavaScript 伪协议地址的时候,会先进行 URL 解码,再执行 JavaScript。
因为浏览器在解析 URL 的时候会进行 URL 解码,那么用户的输入理应进行 URL 编码后再放进 URL 中。这就是我修复这个漏洞的方法,让用户的输入按照浏览器解析的顺序进行编码:先进行 unicode 编码再进行 url 编码。
Ladle vs. Storybook: Measuring performance across project sizes
这个博客的文章质量都很高
后端
-
总结一下:413 错误是因为上传文件的大小超过了限制,需要调整 Nginx 设置,比如在 server 里面加
yamlclient_max_body_size 8M; #配置请求体缓存区大小client_body_buffer_size 128k; #设置客户端请求体最大值fastcgi_intercept_errors on;今天在安装 WordPress 主题时遇到了这个问题,上次遇到好像是在 Mastodon 上传表情包的时候(不确定)
关于 WordPress 上传限制这回事:
什锦
-
Delightful lists are an effort to help bring change to this trend. To make freedom more discoverable again. This top-level project will allow navigation to all high-quality curated delightful lists created and maintained all over the web. Anyone that wishes to do so can create their own list, and thus create an entrypoint to freedom.
-
偶然进入的网站,没有入口也没有出口,比较有年代感了
A set of rules that provides a way of telling a computer what operations to perform is called a programming language. There is not, however, just one programming language; there are many. In this chapter you will learn about controlling a computer through the process of programming. You may even discover that you might want to become a programmer.
-
一点点鸡汤
-
原文:Open source and web3, simplified
“并非所有这些平台本身都开源,但重要的是,与服务模式绑定的收益会直接反馈在其原生代币的价值上。有了这样的设定,随着时间的推移将源代码开放出来的激励是巨大的,因为它让开发者更具活力,让基于服务的生态系统得以存续,并让人们相信,项目将会以最符合网络利益的方式持续运作(因为倘若不这样,它可以被"分叉",即容易被复制)”
“它也不仅仅是代码。想想维基百科、Facebook、Uber、Linux —— 所有这些项目都是由少数人定义平台的规则,然后大量的人参与价值构建。在这些社区中进行价值捕获和分配面临各种困境 ──Facebook 或 Uber 模式让少数人暴富,维基百科或 Linux 模式则几乎无利可图。我上面描述的结构能够让用户参与价值的创造和捕获,既适用于 Facebook 也可用于 Linux。”
How to lazy load images in Hugo
Create the file
layouts/_default/_markup/render-image.html
in your theme with this content:html<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" loading="lazy" />This makes the resulting HTML have the loading="lazy" attribute, which lazily loads images.How Do Dolphins Choose Their Name?
Dolphins identify themselves with a unique whistle that scientists have likened to a human name. Here’s how they decide what to call themselves.
Commonplace Book
Intentionality
every idea matters
just collect very succinct quotes from biographies that i’ve read from books that i’ve read or from articles from of the internet that i’ve read and over time i ended up with this collection of very succinct sentences that but basically every one of these sentences they mean something every one of these words they mean something every expression that i put into this book they’re all very deeply personal for me and also the act of writing for me is very personal because writing for me and journaling for me is a form of calming the brain because my brain does not shut up so point one keeping a commonplacebook on a physical notebook is a lot more deliberate
better editing
writing on the paper at least for me liberates me from that uh illusion of perfection illusion of cleanliness that i get on a computer screen because i can cross everything out i can cross things out straight away and i can spot mistakes and you know weak sentences straight away
Crossing Disciplines