Closed19

記事:2024/4/22-

kzk4043kzk4043
kzk4043kzk4043
kzk4043kzk4043

チラ見

https://www.figma.com/ja/blog/introducing-code-connect/
https://speakerdeck.com/npaka/openaiben-chu-ban-ji-nian-npakaniyoruopenaizui-xin-ji-shu-qing-bao-toji-shu-qing-bao-kiyatutiatupushu?slide=51
https://qiita.com/kd_rn/items/ba320b574bfa81cde40f?utm_source=Qiitaニュース&utm_campaign=7f7bd4f14f-Qiita_newsletter_609_03_13&utm_medium=email&utm_term=0_e44feaa081-7f7bd4f14f-34807157
https://medium.com/swlh/how-to-build-a-1-000-per-month-one-person-business-alongside-a-9-5-job-in-90-days-or-less-9003cb198a14
https://medium.com/orpetron/10-websites-with-exceptional-button-design-that-will-definitely-inspire-you-349cfcde787e
https://awstip.com/title-building-a-clean-and-scalable-frontend-architecture-f4fe1f814f68
https://qiita.com/kojimadev/items/f9f457991dfb6bc58a83
https://zenn.dev/mizchi/articles/wasm-component-model-futures
https://www.maartenhus.nl/blog/comparing-javascript-frameworks-part-1-templates/
https://zenn.dev/moko_poi/articles/c2402f13a870a1
https://devblogs.microsoft.com/typescript/announcing-typescript-5-4/
https://zenn.dev/estra/articles/typescript-type-set-hierarchy
https://alexharri.com/blog/jsdoc-as-an-alternative-typescript-syntax
https://blog.frontend-almanac.com/js-object-structure
https://runtime-compat.unjs.io/
https://www.cantorsparadise.com/how-did-albert-einstein-utilize-his-free-time-7713c65d282c
https://medium.com/coding-beauty/the-7-most-transformative-javascript-features-from-es10-98e482a41a4a
https://qiita.com/Sicut_study/items/fee03dd7e20741a33bc5?utm_source=Qiitaニュース&utm_campaign=1127aad6aa-Qiita_newsletter_611_03_27&utm_medium=email&utm_term=0_e44feaa081-1127aad6aa-34807157

kzk4043kzk4043
kzk4043kzk4043

https://blog.jxck.io/entries/2024-04-26/csrf.html

app.use((req, res, next) => {
  // post である場合は origin と sec-fetch-site をチェック
  if (req.method === "post") {
    // origin は必ずチェック
    if (req.headers.origin !== "https://sns.example") {
      return res.send(400)
    }
    // sec-fetch-site は、存在した場合だけチェック
    if (req.headers.secFetchSite && req.headers.secFetchSite !== "same-origin") {
      return res.send(400)
    }
  }
  return next()
})

// デフォルトに頼らず Cookie に Lax を明示
// 理想は read と write に cookie を分け write を Strict にする
app.use(session("Lax"))

// 副作用のある API は必ず POST にする
app.post("/post", async (req, res) => {
  await createPost(req.body)
  // ...
})
kzk4043kzk4043

https://blog.koh.dev/2024-04-23-nodejs-typescript-module/

まず最初に気をつけなければならないことは「TypeScriptのモジュール記法はESMではない」ということだ。
TypeScriptのプロジェクトを運用していると、依存ライブラリをバージョンアップしたらアプリケーションが動かなくなったというケースに遭遇したことがある人もいるだろう。 それはこのサンプルのように、依存ライブラリがESMで記述されるようになったがtsconfig.jsonの設定でCommonJSのファイルが吐き出されるため、CommonJS -> ESMの読み込みとなってエラーになったというパターンがある。

ああ、そうか、tsって厳密にはesmではないのか…トランスパイル時に設定によって変換されるのね。

package.jsonのtype && compilerOptions.module
"type": "commonjs" && compilerOptions.module: "commonjs" -> CommonJSが生成される
"type": "commonjs" && compilerOptions.module: "NodeNext" -> CommonJSが生成される
"type": "module" && compilerOptions.module: "commonjs" -> CommonJSが生成される
"type": "module" && compilerOptions.module: "NodeNext" -> ESMが生成される
拡張子
.ts -> .js が生成される
.mts -> .mjs が生成される
.cts -> .cjs が生成される

なるほど。

kzk4043kzk4043

https://rxdb.info/articles/localstorage.html

Non-Async Blocking API: One significant drawback is that js localStorage operates as a non-async blocking API. This means that any operations performed on localStorage can potentially block the main thread, leading to slower application performance and a less responsive user experience.
Limited Data Structure: Unlike more advanced databases, localStorage is limited to a simple key-value store. This restriction makes it unsuitable for storing complex data structures or managing relationships between data elements.
Stringification Overhead: Storing JSON data in localStorage requires stringifying the data before storage and parsing it when retrieved. This process introduces performance overhead, potentially slowing down operations by up to 10 times.
Lack of Indexing: localStorage lacks indexing capabilities, making it challenging to perform efficient searches or iterate over data based on specific criteria. This limitation can hinder applications that rely on complex data retrieval.
Tab Blocking: In a multi-tab environment, one tab's localStorage operations can impact the performance of other tabs by monopolizing CPU resources. You can reproduce this behavior by opening this test file in two browser windows and trigger localstorage inserts in one of them. You will observe that the indication spinner will stuck in both windows.
Storage Limit: Browsers typically impose a storage limit of around 5 MiB for each origin's localStorage.

このスクラップは7日前にクローズされました