Skip to content

Instantly share code, notes, and snippets.

Alex Chan alexanderchan

Block or report user

Report or block alexanderchan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@alexanderchan
alexanderchan / package.json
Created Jan 18, 2019 — forked from adamreisnz/package.json
Simple pure npm scripts build process
View package.json
{
"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 Dec 10, 2018 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

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 Jan 12, 2017
write a file and open the contents in atom
View openselectioninatom
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 Nov 1, 2016 — forked from robschmuecker/README.md
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.
View README.md

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.

View index.html
<!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 Mar 4, 2016 — forked from herrstucki/README.md
Transitions with React and D3 I
View README.md
View testautosize.js
/*jshint esnext:true */
class TestAutosize extends React.Component {
constructor(props){
super(props);
this.state = {
searchText: 'some example text'
}
this.autosize = this.autosize.bind(this);
View _.md
View chart.html
<div id="chart">
<h4>Percent of adults over 25 with at least a bachelor's degree:</h4>
<p><strong>Median:</strong> <span class="median"></span></p>
<small>Source: <cite><a href="http://census.gov">U.S. Census Bureau</a></cite>, via <cite><a href="http://beta.censusreporter.org/compare/01000US/040/table/?release=acs2011_1yr&table=B15003">Census Reporter</a></cite></small>
</div>
View index.html
<div ng-app="sortableApp" ng-controller="sortableController" class="container">
<h2>ui.sortable connected lists event order</h2>
<div class="floatleft">
<div ui-sortable="sortableOptionsList[0]" class="apps-container screen floatleft" ng-model="rawScreens[0]">
<div class="app" ng-repeat="app in rawScreens[0]">{{$index}} {{app.title}}</div>
</div>
<div ui-sortable="sortableOptionsList[1]" class="apps-container screen floatleft" ng-model="rawScreens[1]">
<div class="app" ng-repeat="app in rawScreens[1]">{{$index}} {{app.title}}</div>
</div>
You can’t perform that action at this time.