Skip to content

Instantly share code, notes, and snippets.

@marcomontalbano
marcomontalbano / http-request-logger.md
Last active September 14, 2023 15:23
Log all incoming http requests using Deno.

HTTP Request Logger

Log all incoming http requests.

This is useful when you want to test webhooks locally!

Usage

Run this deno command first:

@WebReflection
WebReflection / esx.md
Last active May 6, 2024 08:49
Proposal: an ESX for JS implementation
@DavidWells
DavidWells / github-proxy-client.js
Last active March 15, 2024 08:28
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}`
}
})

React.js Github Repo Spammed

Background

React's official website makes a banner, which offers visitors a way to provide humanitarian aid to Ukraine.
React的官方网站做了一个横幅,为访问者提供了向乌克兰提供人道主义援助的途径。

telegram-cloud-photo-size-5-6127611897286078767-x

Then, many people went to the React.js Github repository and opened lots of spam issues with anti-US and anti-Ukrainian comments in an apparent form of digital protest. The messages are in English and Mandarin.
然后,很多人到React.js Github 仓库中开了很多带有反美国和反乌克兰 issue,进行一种数字化的抗议。这些信息是用英语和普通话写的。

Cheat sheet: modules

Named exports, named imports, namespace imports

If we put export in front of a named entity inside a module, it becomes a named export of that module. All other entities are private to the module.

//===== lib1.mjs =====
// Named exports
As noted by @murdats below, there are more URLs than just these 1440 ones, depending on the argument values
that are hashed (as the filenames below are MD5 hashes of a few arguments: red/blue pill color, HHMM time, etc.)
You can read details about the algorithm used to generate these URLs here:
https://news.ycombinator.com/item?id=28448335
---
00:00 https://thechoiceisyours.whatisthematrix.com/generated/v7/high/d43725991d28ffcab04aa716762cf6af.mp4
@sindresorhus
sindresorhus / esm-package.md
Last active May 14, 2024 20:18
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@rauschma
rauschma / impatient-js-es2021.md
Last active August 31, 2023 07:02
ES2021 edition of “JavaScript for impatient programmers”

What is new in the ES2021 edition of “JavaScript for impatient programmers”?

Free to read online: exploringjs.com/impatient-js/

  • The exercises now run as native ESM modules on Node.js. Previously, they were run via the esm package.
  • Material on new ES2021 features:
    • String.prototype.replaceAll()
    • Promise.any()
    • Logical assignment operators
  • Underscores (_) as separators in number literals and bigint literals
@prologic
prologic / LearnGoIn5mins.md
Last active May 9, 2024 20:15
Learn Go in ~5mins
@khusseini
khusseini / README.md
Last active August 25, 2022 04:04
Adding traefik to LKS

Setup Traefik 2.2 with Let's Encrypt On LKE

If you searched for this article I chances are you know what LKE, Traefik and Let's Encrypt are, else here is a quick primer:

What is LKE?

"The Linode Kubernetes Engine (LKE) is a fully-managed container orchestration engine for deploying and managing containerized applications and workloads.". For more information please have a look at "Deploy and manage a cluster with Linode Kubernetes Engine"