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.
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active Nov 7, 2019
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 for-krainbolt.sh
#!/bin/bash
a () {
sleep 1
echo a
}
b () {
sleep 1
echo b
}
View gist:38204dd8862e549d5d5209fa1d21b36a
diff --git a/cache.js b/cache.js
index f842ba1..f00de14 100644
--- a/cache.js
+++ b/cache.js
@@ -169,7 +169,7 @@ module.exports = class Cache {
cacheTargetStream ? cacheTargetStream.end(done) : done()
})
const oldBody = response.body
- const newBody = through({highWaterMark: fitInMemory && MAX_MEM_SIZE})
+ const newBody = through({highWaterMark: MAX_MEM_SIZE})
View gist:f5e33bff9eeab07aad1cc80a9a3c2425
diff --git a/cache.js b/cache.js
index ee2ba68..ff7e1a4 100644
--- a/cache.js
+++ b/cache.js
@@ -65,10 +65,10 @@ module.exports = class Cache {
// avoid opening cache file handles until a user actually tries to
// read from it.
const body = new Minipass()
- const notFitInMemory = false && info.size > MAX_MEM_SIZE
+ const fitInMemory = info.size < MAX_MEM_SIZE
View index.js
const gfs2 = require('gf')
const gfs = require('graceful-fs')
const fs = require('fs')
gfs.gracefulify(fs)
gfs2.gracefulify(fs)
fs.createReadStream(__filename)
@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",
View npm package list puzzle.md

Here's a puzzle to noodle on:

Let's say package.json contains this:

{
  "files": [
    "lib",
    "!lib/one",
    "lib/two"
  ]
View read-git-index.js
const fs = require('fs')
const index = fs.readFileSync('.git/index')
const result = {}
let p = 0
result.signature = index.slice(p, p + 4).toString('ascii')
p += 4
if (result.signature !== 'DIRC') {
throw new Error('not a git index file')
}
View .vimrc
" Specify a directory for plugins
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-sensible'
Plug 'pangloss/vim-javascript'
Plug 'mxw/vim-jsx'
call plug#end()
set nu
set encoding=utf-8
let mapleader=","
You can’t perform that action at this time.