Skip to content

Instantly share code, notes, and snippets.

View ivanlanin's full-sized avatar

Ivan Lanin ivanlanin

View GitHub Profile
@robschmuecker
robschmuecker / README.md
Last active July 22, 2024 12:38
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.

@mbostock
mbostock / .block
Last active August 20, 2024 14:19
Wrapping Long Labels
license: gpl-3.0
@0thernet
0thernet / README.md
Last active July 3, 2023 14:07
Force Editor + Pan/Zoom

Drag from an existing node to add a new node or link. Click to select/deselect nodes/links. Hit the DELETE key to remove the selected node or link. Drag to pan. Scroll to zoom.

Built with D3.js.

@troelskn
troelskn / gist:773216
Created January 10, 2011 18:40
json_encode_pretty
<?php
/**
* Input an object, returns a json-ized string of said object, pretty-printed
*
* @param mixed $obj The array or object to encode
* @return string JSON formatted output
*/
function json_encode_pretty($obj, $indentation = 0) {
switch (gettype($obj)) {
case 'object':