Skip to content

Instantly share code, notes, and snippets.

alexanderchan / cli-example.ts
Last active October 10, 2023 22:37
quick commander example
#!/usr/bin/env node
import { config } from 'dotenv'
import { Command } from 'commander'
import { z } from 'zod'
const exampleCommand = new Command()
alexanderchan /
Last active December 18, 2020 00:03 — forked from yinzara/
Managing SSH keys and repo cloning using multiple accounts on GitHub and BitBucket

Why Multiple SSH keys?

There are numerous reasons you may need to use multiple SSH keys for accessing GitHub and BitBucket

You may use the same computer for work and personal development and need to separate your work.

When acting as a consultant, it is common to have multiple GitHub and/or BitBucket accounts depending on which client you may be working for.

You may have different projects you're working on where you would like to segregate your access.

alexanderchan / package.json
Created January 18, 2019 17:49 — forked from adamreisnz/package.json
Simple pure npm scripts build process
"name": "project-name",
"description": "Template for static sites",
"version": "1.0.0",
"homepage": "",
"author": {
"name": "Adam Buczynski",
"url": ""
"license": "UNLICENSED",
alexanderchan /
Created December 10, 2018 21:14 — forked from bastman/
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

alexanderchan / openselectioninatom
Created January 12, 2017 03:30
write a file and open the contents in atom
function run(input, parameters) {
var str = $.NSString.alloc.initWithUTF8String(input);
var jsonPath = Path('/tmp/test.json');
str.writeToFileAtomically(jsonPath.toString(), true);
var atom = Application('Atom')
alexanderchan /
Created November 1, 2016 14:32 — forked from robschmuecker/
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.

<!DOCTYPE html>
<meta charset="utf-8">
<title>JS Bin</title>
<script src=""></script>
alexanderchan /
Last active March 4, 2016 23:54 — forked from jstcki/
Transitions with React and D3 I
/*jshint esnext:true */
class TestAutosize extends React.Component {
this.state = {
searchText: 'some example text'
this.autosize = this.autosize.bind(this);
alexanderchan /
Last active August 29, 2015 14:20