Skip to content

Instantly share code, notes, and snippets.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\tyler\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'un',
1 verbose cli 'lodash' ]
2 info using npm@5.3.0
3 info using node@v8.2.1
4 verbose npm-session 183b62c0437ca1ee
5 silly install loadCurrentTree
6 silly install readLocalPackageData
@tswaters
tswaters / instructions.md
Last active November 29, 2017 02:54
Using Seneca-Web with request$ and response$

Using Seneca-Web with request$ and response$

node web-host.js

In another terminal

node web-client.js
@tswaters
tswaters / tag-npm-versions.sh
Created February 13, 2018 16:54
Add tags to git repo based on npm view output
#!/usr/bin/env bash
for version in $(npm view $1 --json | jq '.versions[]' -c -r); do
sha=$(npm view $1@$version --json | jq '.gitHead' -c -r)
echo Tagging $sha as v$version
git tag -a "v$version" $sha -m "Release v$version"
done
@tswaters
tswaters / maze.js
Last active September 22, 2018 20:56
maze generation in terminal
'use strict'
const readline = require('readline')
const NORTH = 0b1000
const SOUTH = 0b0100
const EAST = 0b0010
const WEST = 0b0001
const ALL = 0b1111
@tswaters
tswaters / random.js
Created September 23, 2018 20:06
random number using node crypto
'use strict'
const assert = require('assert')
const crypto = require('crypto')
module.exports = (min, max) => {
// borrowed from http://stackoverflow.com/a/33627342
// figure out range and how many bytes required
@tswaters
tswaters / canvas.html
Created September 29, 2018 03:31
Cards on canvas
<!doctype html>
<html>
<head>
<meta charet="utf-8"/>
<style>
canvas {
image-rendering: crisp-edges;
margin: 5px;
}
canvas.horizontal {
@tswaters
tswaters / .dockerignore
Last active October 10, 2022 22:57
node dockerfile
.git
node_modules
dist
public
'use strict'
// error-prone work function
const _work = (name, failure_rate) => (thing) =>
new Promise((resolve, reject) => {
setTimeout(() => {
if (Math.random() < failure_rate) {
console.log(`${name} failed - ${JSON.stringify(thing)}`)
reject(new Error(`${name} hit above ${failure_rate}`))
} else {
@tswaters
tswaters / bench.js
Last active September 13, 2019 05:49
seneca-web-adapter-express bench
'use strict'
const { runMain, show } = require('bench')
const express = require('express');
const Seneca = require('seneca');
const SenecaWeb = require('seneca-web');
const adapter = require('..');
const Request = require('request')
### Keybase proof
I hereby claim:
* I am tswaters on github.
* I am tswaters (https://keybase.io/tswaters) on keybase.
* I have a public key ASAm_89GCHVXoI95zX9hNRCPpZH-qf9RlS2mR4qQBBHWOgo
To claim this, I am signing this object: