Skip to content

Instantly share code, notes, and snippets.

View vasco-santos's full-sized avatar
🥁

Vasco Santos vasco-santos

🥁
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active May 20, 2024 14:52
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.
@alanshaw
alanshaw / streaming-iterables.md
Last active September 22, 2023 23:49
Streaming iterables WAT?

Streaming iterables

Your friends from pull stream, but in terms of async iterators.

source it

A "source" is something that can be consumed. It is an iterable object.

const ints = {
@jacobheun
jacobheun / libp2p-badges.md
Last active April 14, 2019 14:45
Generate badges

A crude script for generating libp2p repo badges.

./badges.js <project> # where project is the name of the repo in the libp2p org

badges.js

#!/usr/bin/env node
@harrishancock
harrishancock / streaming-responses-200.js
Created March 1, 2018 18:48
Cloudflare Workers streaming response bodies example with unconditional 200
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
/**
* Make multiple requests,
* aggregate the responses and
* stream it back as a single response.
*/
async function fetchAndApply(request) {
@jimothyGator
jimothyGator / README.md
Last active April 25, 2024 18:00
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@wdjunaidi
wdjunaidi / gist:1762114
Created February 7, 2012 21:27
curl - passing arrays and file as multipart/form-data
curl -vX POST <url> -F <arraykey>[0]=<value0> -F <arraykey>[1]=<value1> -F <arraykey>[2]=<value2> -F <key>=@<filename>