Instantly share code, notes, and snippets.

View destroy-test.js
'use strict'
const { Writable } = require('readable-stream')
let stream
console.log('write')
stream = getStream()
stream.write('foo')
View server.js
'use strict'
const zlib = require('zlib')
const http = require('http')
const body = zlib.gzipSync(JSON.stringify({
errors: {
ERR_QUEUE_FULL: {
count: 23,
message: 'queue is full'
View server.js
'use strict'
const http = require('http')
const server = http.createServer(function (req, res) {
console.log(req.method, req.url)
res.socket.end() // Half-close the socket by sending FIN packet
})
server.listen(8200, function () {
View README.md
View boom.js
var assert = require('assert')
var events = require('events')
assert(events.usingDomains)
View install-elasticsearch.ps1
Write-Host "Preparing to download and install Elasticsearch..." -ForegroundColor Cyan
$esVersion = "6.1.2"
$downloadUrl = "https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$($esVersion).zip"
$zipPath = "$($env:USERPROFILE)\elasticsearch-$esVersion.zip"
$extractRoot = "$env:SYSTEMDRIVE\Elasticsearch"
$esRoot = "$extractRoot\elasticsearch-$esVersion"
Write-Host "Downloading Elasticsearch..."
(New-Object Net.WebClient).DownloadFile($downloadUrl, $zipPath)
7z x $zipPath -y -o"$extractRoot" | Out-Null
View install-redis.ps1
Write-Host "Downloading Redis..." -ForegroundColor Cyan
$redisRoot = "$env:SYSTEMDRIVE\Redis"
$zipPath = "$($env:USERPROFILE)\redis-2.8.19.zip"
(New-Object Net.WebClient).DownloadFile('https://github.com/MSOpenTech/redis/releases/download/win-2.8.19/redis-2.8.19.zip', $zipPath)
7z x $zipPath -y -o"$redisRoot" | Out-Null
del $zipPath
Write-Host "Installing Redis as a Windows service..."
& "$redisRoot\redis-server.exe" --service-install
View christmas-dinner.md

Copenhagen Node.js Christmas Dinner

Date: January 6th 2018
Time: 5pm -> ?

Location

Zendesk DK HQ
Snaregade 12, 2nd floor
1205 Copenhagen

View bisect.sh
#!/usr/bin/env bash
# This script is an easy way to bisect between two releases of Node.js
if [ $# -ne 2 ]; then
echo "Error: No arguments supplied!"
echo "Usage:"
echo " ./bisect.sh <git-ref> <git-ref>"
echo
echo "Example:"
View npm-seq-203248.js
{ seq: 203248,
id: 'testx2',
changes: [ { rev: '1-53eafb13e023fc3a7a1b319a3eb17b2a' } ],
doc:
{ _id: 'testx2',
_rev: '1-53eafb13e023fc3a7a1b319a3eb17b2a',
name: 'testx2',
versions:
{ '1.0.0':
{ dist: { tarball: 'http://registry.npmjs.org/testx2/-/a' },