Skip to content

Instantly share code, notes, and snippets.

@khalidx
khalidx / node-typescript-esm.md
Last active July 3, 2024 18:04
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@DavidWells
DavidWells / github-proxy-client.js
Last active June 27, 2024 14:52
Full Github REST api in 34 lines of code
/* Ultra lightweight Github REST Client */
// original inspiration via https://gist.github.com/v1vendi/75d5e5dad7a2d1ef3fcb48234e4528cb
const token = 'github-token-here'
const githubClient = generateAPI('https://api.github.com', {
headers: {
'User-Agent': 'xyz',
'Authorization': `bearer ${token}`
}
})
@BiosBoy
BiosBoy / Configuration file for Webpack 4 + Webpack Hot Module Replacement + BrowserSync + React 16.js
Last active November 12, 2020 03:16
Configuration file for Webpack 4 + Webpack Hot Module Replacement + BrowserSync + React 16
//App structure:
// app_folder/
// webpack.config.js
// /server/
// server.js
// /src/
// index.js
// How to run: from root folder run command: "node server/server"

Time Travel Debugging

Time Travel refers to the ability to record a tab and later replay it ([WebReplay][wrr]). The technology is useful for local development, where you might want to:

  • pause and step forwards or backwards
  • pause and rewind to a prior state
  • rewind to the time a console message was logged
  • rewind to the time an element had a certain style or layout
  • rewind to the time a network asset loaded
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@wildjcrt
wildjcrt / 無架構的暴政文摘.txt
Last active June 7, 2024 17:04
《無架構的暴政》一文重點整理
# 《無架構的暴政》文摘
Digest of "THE TYRANNY of STRUCTURELESSNESS by Jo Freeman a.k.a. Joreen"
http://blog.roodo.com/dkchen10/archives/4728841.html
## tl;dr
任何組織或團體在草創期多半都是無架構,但隨著組織團體規模變大,它們必須要制定出適合自己團體的架構,才能有所作為、確保成員共同參與,同時避免混亂。
* 團體架構的基本原則,可以參考第 6 段。
* 團體內產生一個或多個小群體是正常的,群體之間彼此競爭是健康的,可以參考第 4 段。
@taiansu
taiansu / 0_Outline.md
Last active March 24, 2019 04:21
Install Elixir and phoenix

Elixir 安装導覧

我們將安裝下列項目:

  1. Elixir
  2. Node.js
  3. Postgresql 資料庫
  4. Phoenix

由於 macOS 及 linux 可以使用 asdf 這個語言版本管理器,所以我們將介紹用它來安裝 elixir 及 nodejs 的方式。而 Windows 則會使用 chocolatey 來安裝。

@markblundeberg
markblundeberg / atomic-size-attack.md
Created February 16, 2018 05:14
Advisory: secret size attack on cross-chain hash lock smart contracts

Advisory: secret size attack on cross-chain hash lock smart contracts

Dr. Mark B Lundeberg, 2018 Feb 15 bitcoincash:qqy9myvyt7qffgye5a2mn2vn8ry95qm6asy40ptgx2

This security advisory notes a vulnerability in the common construction of cross-chain smart contracts (contracts between distinct cryptocurrencies) through hash locking. I focus on the primary use case in [atomic