Skip to content

Instantly share code, notes, and snippets.


Assaf Arkin assaf

Block or report user

Report or block assaf

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 hostnames.txt
View gist:241ea1d12f975f863983
const Util = require('util');
const a = [];
console.log([].concat(a).length); // => 0
console.log([]; // => 0
const Arrayish = function() {;
Util.inherits(Arrayish, Array);
assaf / nvmish
Created Mar 24, 2015
nvm use <package.json>
View nvmish
#!/usr/bin/env bash
# Run nvmish in your current project directory to use the version of io.js/Node
# as specified in package.json. It will also install that version, if not
# already installed.
# If package.json specifies engines.iojs, uses the corresponding version of
# io.js, otherwise, if package.json specifies engines.node, uses the
# corresponding version of Node.js.
assaf / gist:ebd81856ca725f080c52
Created Nov 11, 2014
Zero downtime deploy with Dokku (original blog post)
View gist:ebd81856ca725f080c52

Dokku is a wonderful tool for quickly deploying apps to production, but it's missing zero downtime deploys. Not anymore!

Even our svelte Node.js app needs a few seconds to fully load the main code, and open connections to back-ends servers, before it can start handling requests.

The thing with Dokku: it switches traffic over to the new container before the server loads complete, so each deploy has several seconds of downtime.

That's best case scenario. When we screw deployment (usually some configuration issue that's different in production), even the quickest hands in the west, you still get a few minutes of downtime.

And so it became necessary that I learn how to catch and handle exceptions in Bash (yay, traps!) and shift a few lines of code around.

View gist:d07a39f32fcc697cb1a8
var Immutable = require("immutable"),
t = require("transducers-js"),
comp = t.comp,
map =,
filter = t.filter,
transduce = t.transduce;
var inc = function(n) { return n + 1; };
var isEven = function(n) { return n % 2 == 0; };
var sum = function(a,b) { return a+b; };

Keybase proof

I hereby claim:

  • I am assaf on github.
  • I am assaf ( on keybase.
  • I have a public key whose fingerprint is E318 FD85 22D4 CBAE 142D F811 43A7 A5CA 24D1 FDF5

To claim this, I am signing this object:

View gist:6bc56255459aa75f27b3
# Run npm shrinkwrap on every commit, make sure we have the most recent
# dependencies checked into git.
DEPTH=10 # Set this to N to include more descendants in shrinkwrap
# Success or error, npm shrinkwrap will output to both stdout and stderr.
# We're only interested in what stderr has to say when it fails.
View gist:9674758
// Liberally adapted from our test suites, which uses generators for complex steps (before/after/etc).
describe("With new customer", function() {
let business;
let customer1, customer2, customer3;
before(function*() {
// We have many tests, but you can only call listen() once
// on an HTTP server, so this is a case for resolve-once, and
// we use a promise.
yield Server.listen();
View .vimrc
version 7.0
if &cp | set nocp | endif
let s:cpo_save=&cpo
set cpo&vim
let &cpo=s:cpo_save
unlet s:cpo_save
set cscopeprg=/usr/bin/cscope
set cscopetag
set cscopeverbose
set fileencodings=utf-8,latin1
View .inputrc
set horizontal-scroll-mode off
set mark-modified-lines on
"\C-J": menu-complete
"\C-r": redraw-current-line
# By default up/down are bound to previous-history
# and next-history respectively. The following does the
# same but gives the extra functionality where if you
# type any text (or more accurately, if there is any text
# between the start of the line and the cursor),
You can’t perform that action at this time.