Skip to content

Instantly share code, notes, and snippets.

@alexanderchan
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'
config()
const exampleCommand = new Command()
.command('example-command')
@alexanderchan
alexanderchan / github_bitbucket_multiple_ssh_keys.md
Last active December 18, 2020 00:03 — forked from yinzara/github_bitbucket_multiple_ssh_keys.md
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
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": "http://www.project-name.com",
"author": {
"name": "Adam Buczynski",
"url": "http://adambuczynski.com"
},
"license": "UNLICENSED",
@alexanderchan
alexanderchan / docker-cleanup-resources.md
Created December 10, 2018 21:14 — forked from bastman/docker-cleanup-resources.md
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: https://github.com/chadoe/docker-cleanup-volumes

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

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

@alexanderchan
alexanderchan / openselectioninatom
Created January 12, 2017 03:30
write a file and open the contents in atom
function run(input, parameters) {
ObjC.import('Cocoa');
var str = $.NSString.alloc.initWithUTF8String(input);
var jsonPath = Path('/tmp/test.json');
str.writeToFileAtomically(jsonPath.toString(), true);
var atom = Application('Atom')
atom.open(jsonPath)
@alexanderchan
alexanderchan / README.md
Created November 1, 2016 14:32 — forked from robschmuecker/README.md
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>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
@alexanderchan
alexanderchan / README.md
Last active March 4, 2016 23:54 — forked from jstcki/README.md
Transitions with React and D3 I
/*jshint esnext:true */
class TestAutosize extends React.Component {
constructor(props){
super(props);
this.state = {
searchText: 'some example text'
}
this.autosize = this.autosize.bind(this);
@alexanderchan
alexanderchan / _.md
Last active August 29, 2015 14:20
test2