Skip to content

Instantly share code, notes, and snippets.

Avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
View foobar.tar
foo\bar000644 000765 000024 00000000000 14102565404 013002 0ustar00isaacsstaff000000 000000
View gist:6adfaf0ea3d9df4fef07e9ac5700bf74
diff --git a/index.js b/index.js
index 56cbd66..b88f64b 100644
--- a/index.js
+++ b/index.js
@@ -8,6 +8,7 @@ const EOF = Symbol('EOF')
const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
const EMITTED_END = Symbol('emittedEnd')
const EMITTING_END = Symbol('emittingEnd')
+const EMITTED_ERROR = Symbol('emittedError')
const CLOSED = Symbol('closed')
View gist:45219b68cb454a08db2a7db54c4e41d8
diff --git a/index.js b/index.js
index 56cbd66..b88f64b 100644
--- a/index.js
+++ b/index.js
@@ -8,6 +8,7 @@ const EOF = Symbol('EOF')
const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
const EMITTED_END = Symbol('emittedEnd')
const EMITTING_END = Symbol('emittingEnd')
+const EMITTED_ERROR = Symbol('emittedError')
const CLOSED = Symbol('closed')
View examples-redos-slash-ending.js
#!/usr/bin/env node
const re = /\/+$/
const batchStrings = [
new Array(Math.pow(2, 20) + 1).join('/'),
new Array(Math.pow(2, 18) + 1).join('/'),
new Array(Math.pow(2, 17) + 1).join('/'),
new Array(Math.pow(2, 16) + 1).join('/'),
new Array(Math.pow(2, 15) + 1).join('/'),
new Array(Math.pow(2, 14) + 1).join('/'),
View gist:e9b878aa04fb988558cdc37c74d6b063
$ tree
.
├── .npmrc
├── foo
│ ├── .npmrc
│ ├── a
│ │ └── b
│ │ └── c
│ │ └── d
│ │ └── e
View node_modules-npm-pick-manifest-index.js
'use strict'
const npa = require('npm-package-arg')
const semver = require('semver')
const { checkEngine } = require('npm-install-checks')
const engineOk = (manifest, npmVersion, nodeVersion) => {
try {
checkEngine(manifest, npmVersion, nodeVersion)
return true
View gh-274.sh
#!/bin/bash
mkdir -p gh-274/folder1
touch gh-274/folder1/main.js
touch gh-274/index.js
tree gh-274/
node - <<JS
const tar = require('./')
tar.c({
View wait.js
const fs = require('fs')
const gfs = require('./')
const filename = 'foo'
console.log('starting')
// fill up the set of available file descriptors
const fds = []
while (true) {
try {
fds.push(fs.openSync(filename, 'w'))
View test.js
const {promisify} = require('util')
const rpj = promisify(require('read-package-json'))
const rpjf = require('read-package-json-fast')
const pj = require.resolve('./package.json')
Promise.all([
rpj(pj),
rpjf(pj),
]).then(console.log)
View flush-stdout.js
#!/usr/bin/env node
const doFlush = process.argv.includes('flush')
const child = () => {
const N = 1e6
for (let i = 0; i < N; i++) {
const arr = [i,i,i,i,i,i,i,i,i,i]
const a = arr.toString() + ' ' + arr.length