Skip to content

Instantly share code, notes, and snippets.

View dshaw's full-sized avatar
🦄
Always bet on Node.js ✨

Dan Shaw dshaw

🦄
Always bet on Node.js ✨
View GitHub Profile

Here is what continuation-local-storage is expecting from async-listener:

(scenario: three asynchronous / calls in a single continuation chain)

  create[1]
      |
      |
  before[1]
      |      create[2]
 after[1] |
@max-mapper
max-mapper / ms-logger.js
Created March 4, 2014 04:11
partial tap output w/ how long each test took
var time = +Date.now()
var testId = 0
console.log('TAP version 13')
tape.createStream({ objectMode: true }).on('data', function (row) {
if (row.type === 'test') {
console.log('# ' + row.name)
}
if (row.type === 'assert') {
testId++
@totherik
totherik / npmjs.ini
Last active August 29, 2015 13:56
npmjs.org registry install script
; CouchDB Config
; Drop in PREFIX/local.d/npmjs.ini
[couch_httpd_auth]
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev
users_db_public = true
[httpd]
secure_rewrites = false
@tlivings
tlivings / results.md
Last active December 30, 2015 12:59
Node.js outbound SSL testing

Overview

Testing out fedor's SSL enhancements. You don't notice the difference... At first!

Once you adjust ciphers to disable ECDH, then you get the nice surprise.

Test Description

Running an http server that acts as a proxy to an SSL server, all running on localhost.

@creationix
creationix / app.js
Last active December 30, 2015 07:29
Generate a tree of events using process.addAsyncListener
var http = require('http');
var send = require('send');
var urlParse = require('url').parse;
var count = 2;
var server = http.createServer(function (req, res) {
if (!--count) server.close(); // Only allow two connection and then exit.
send(req, urlParse(req.url).pathname)
.root(__dirname)
.pipe(res);
@morganrallen
morganrallen / sphero-bridge.js
Created November 21, 2013 03:01
left overs from NKO4
Math.TAU = Math.PI + Math.PI;
const TO_DEGREES = 180 / Math.PI;
const TO_RADIANS = Math.PI / 180;
function headingFromDelta(x, y) {
var a = Math.atan2(y, x);
if(a < 0) a = (a + Math.PI) + Math.PI;
// janky rotation by 90deg
a = Math.round(a * TO_DEGREES);
@dherman
dherman / realms-api.md
Last active September 7, 2024 17:42
ES6 Realms API

Notational Conventions

This section describes the conventions used here to describe type signatures.

A [T] is an array-like value (only ever used read-only in this API), i.e., one with an integer length and whose indexed properties from 0 to length - 1 are of type T.

A type T? should be read as T | undefined -- that is, an optional value that may be undefined.

Realms

@othiym23
othiym23 / yay-area-node-meetup-proposal.md
Last active December 28, 2015 06:09
How make better Bay Area Node meetups?

Goals

  1. Capture some of the benefit of NodeConf, JSConf or RealTimeConf on a sustainable, regular basis.
  2. Get enough of a quorum of Bay Area Node.js leadership involved to appeal to other people to attend and get involved themselves. This includes not just visible leadership, but valuable less-visible contributors like jlord, Dave Pacheco, Emily Tanaka-Delgado, and Daniel Erickson.
  3. Provide an in-person forum to work through Node issues and improve and broaden the community.
  4. Foster broader leadership by getting more people more involved.
  5. Spread the organizational load among a wider crew of people so no one individual gets burnt out, more people get experience with running events, and we all are able to have fun.
  6. If there is to be a bias when making speaker selections, have it be towards bringing in new speakers and creating a safe space for speakers to present new material.
  7. Keep it fast-moving, entertaining, and concise -- have 2-hour (tops) meetups and then allow people to do social s
@bahamas10
bahamas10 / bashrc
Last active December 25, 2015 07:19
Billable amount in Joyent Manta
# Total the billable amount in Manta
mbillable() {
mget -q ~~/reports/usage/storage/latest |\
json storage.public.bytes storage.stor.bytes |\
awk '
{
s += $1;
}
END {
billable = (s / 1024 / 1024 / 1024) + 1;
@nshalman
nshalman / explorer.js
Last active December 24, 2015 16:19
Manta Explorer
#!/usr/bin/env node
var restify = require('restify');
var path = require('path');
var fs = require('fs');
var assert = require('assert');
var manta = require('manta');
var client = manta.createClient({
sign: manta.privateKeySigner({