npm list <module>
Show all the different copies of a module that are installed.
#!/usr/bin/env node | |
// Clean up JSON from openlibrary.org and output as NDJSON. | |
// use: | |
// curl 'http://openlibrary.org/subjects/love.json' | ./toNdjson.js | |
var JSONStream = require('JSONStream'); | |
var map = require('through2-map'); | |
var cherryPick = map.obj(function(obj) { | |
return { |
# 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. |
#!/bin/sh | |
usage () { | |
printf "Usage: build-umd <argument>\n" | |
} | |
# use zopfli for better compression if available | |
gzip () { | |
zopfli -h 2>/dev/null | |
if [ $? -eq 0 ]; then |
// see https://github.com/karissa/karissa.github.io/blob/master/js/force.js | |
var d3 = require('d3') | |
var json = { | |
nodes: [ | |
{name: 'karissa', image: '/images/github.ico', url: 'http://github.com/karissa'}, | |
{name: '@okdistribute', image: '/images/twitter.ico', url: 'http://twitter.com/okdistribute'}, | |
{name: 'karissamck', image: '/images/linkedin.ico', url: 'https://www.linkedin.com/in/krmckelv'}, | |
{name: 'karissa.mckelvey', image: '/images/facebook.ico'}, | |
{name: 'indiana', image: '/images/indiana.ico', url: 'http://indiana.edu'}, |
alias oneline="tr -d '\n' | tr -s ' ' | sed -e '\$a\\'" | |
alias random="node -e \"console.log(require('crypto').randomBytes(32).toString('hex'));\"" | |
alias lsd="ls -lF -G | grep --color=never '^d'" | |
# IP addresses | |
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" | |
# Trim new lines and copy to clipboard | |
alias c="tr -d '\n' | pbcopy" |
{ | |
"scripts": { | |
"start": "node-sass src/style/main.scss --source-map-embed > public/style.css && concurrently --kill-others \"npm run serve\" \"npm run sass-watch\"", | |
"serve": "env $(cat .env | xargs) VERSION=`cat package.json | json version` budo src/index.js:bundle.js --pushstate --dir=public --live -- -t babelify -g aliasify -t [ envify --NODE_ENV development ] -dv", | |
"cypress-ci": "start-server-and-test start http://localhost:9966 cy:run", | |
"cy:run": "cypress run --config baseUrl=\"http://localhost:9966\"" | |
}, | |
"devDependencies": { | |
"start-server-and-test": "^1.7.11", | |
} |
const webcrypto = window.crypto | |
import * as uint8arrays from 'uint8arrays' | |
// data should be Uint8Array | |
function getHash (data) { | |
let _data = data | |
if (typeof data === 'string') { | |
const te = new TextEncoder() | |
_data = te.encode(data) |
// get the last segment of a path or URL | |
function getLastItem (thePath) { | |
const pathArr = thePath.split('/') | |
// handle trailing slash | |
return (pathArr[pathArr.length - 1] || pathArr[pathArr.length - 2]) | |
} |
'use strict'; | |
const os = require('os'); | |
const homeDirectory = os.homedir(); | |
module.exports = pathWithTilde => { | |
if (typeof pathWithTilde !== 'string') { | |
throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`); | |
} |