Skip to content

Instantly share code, notes, and snippets.

@alexanderchan
alexanderchan / README.md
Last active August 29, 2015 14:03 — forked from mbostock/.block
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Virtual Scrolling Demo</title>
<style>
html, body {
width: 100%;
height: 100%;
margin: 0;
@alexanderchan
alexanderchan / app.js
Last active August 29, 2015 14:04
Examples of focus for iOS
function focus() {
$('input').focus();
}
$(focus);
$(function() {
$(document.body).load(focus);
$('#click').click(focus);
$('#click-timeout').click(function() {
setTimeout(focus);
});
@alexanderchan
alexanderchan / index.html
Created September 10, 2014 13:37
A Pen by Alex.
<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>
<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>
@alexanderchan
alexanderchan / _.md
Last active August 29, 2015 14:20
test2
/*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 / README.md
Last active March 4, 2016 23:54 — forked from jstcki/README.md
Transitions with React and D3 I
<!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
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.