Skip to content

Instantly share code, notes, and snippets.

🔮
the only way out is through

isaacs isaacs

🔮
the only way out is through
Block or report user

Report or block isaacs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
View lib-arborist-tracker.js
const _progress = Symbol('_progress')
const npmlog = require('npmlog') // to be removed...
const procLog = require('./proc-log.js')
module.exports = cls => class Tracker extends cls {
constructor (options = {}) {
super(options)
this.log = options.log || npmlog || procLog
@isaacs
isaacs / comma-first-var.js
Created Apr 6, 2010
A better coding convention for lists and object literals in JavaScript
View comma-first-var.js
// See comments below.
// This code sample and justification brought to you by
// Isaac Z. Schlueter, aka isaacs
// standard style
var a = "ape",
b = "bat",
c = "cat",
d = "dog",
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Jan 14, 2020
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
View node-and-npm-in-30-seconds.sh
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
View gist:70de2395bc36de13b555ab3fb950b6e2
ssh-dss AAAAB3NzaC1kc3MAAACBAJ6M0r6x1VWmMZL4/QUfIpFX8hJb0z4yyxgkWI1TDYnFNd3lgI4l5zGZQgnyeaL14BoBbiEoIfAAlQ9dzAYYiX7M5STvR543eLY08Ft15T7vmufmE2aAKQhCyb8Q1bHk3rUHeE4l+DzRXirs53s53MbrG/iiYFOb3yieYrbUkRMlAAAAFQDnjodne9N5V4kC/9PLOdS7hSwUxwAAAIAK5iA45rDaMeEfBwpV7W8DyBvVqy7SBe4av8n547YnVM/n762r3vRl/KlCqpyrgH13aH5YktDrWpKAmlqo7vVCLF2zfTMWkXUKiYuojc/jEcJpi1ayOE0Sa5eH3dQJ17Ilc2prLVGS95/6bEl4ZQv+PLujaibcQ+YArkRPsL7xkwAAAIAZ/AbmFPNMamPYjBh6UV1glBnTBdUhNH0SmWFgBgngyWFQq6Y/SVFa1MHLHWFapixNE5g9c6IcdXS1W+N2Xmb7AnJum8oseMjs6VxAH5AQQHllTE15JspeotaBZsgKWFXH5s/gNEC9mOqqtbM0BA+tqVKXN24lVGEEmHqqfcFBsg== isaacs@sistertrain-lm
View gist:0b48c7f010bf20614a070d3f91f2a015
diff --git a/lib/test.js b/lib/test.js
index dbd559a..4bc4147 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -1060,6 +1060,35 @@ class Test extends Base {
return this.ok(!obj, message, extra)
}
+ doesNotEmit (emitter, event, message, extra) {
+ this.currentAssert = Test.prototype.doesNotEmit
View throw.js
const t = require('tap')
t.test('throw immediately', t => {
throw new Error('thrown immediately')
})
t.test('throw in nextTick', t => {
process.nextTick(() => {
throw new Error('thrown in next tick')
})
View notes-reify.md

tree reification

For the tree:

a
+-- b
|   +-- c
|   +-- d
|   |   +-- e
View escape.sh
#!/bin/bash
TEST=$'foo\n\nbar'
printf %q "$TEST"
View prune-dev.js
// usage: put this in your package.json
// "scripts": {
// "prepublishOnly": "node prune-dev.js",
// "postpublish": "git checkout npm-shrinkwrap.json"
// }
const prune = sw => {
if (sw.dependencies) {
for (const [name, dep] of Object.entries(sw.dependencies)) {
if (dep.dev)
delete sw.dependencies[name]
You can’t perform that action at this time.