Skip to content

Instantly share code, notes, and snippets.

View trinary's full-sized avatar

Erik Cunningham trinary

View GitHub Profile
@trinary
trinary / index.html
Last active August 29, 2015 13:56
Collatz (3n + 1) Conjecture
<!DOCTYPE html>
<meta charset="utf-8">
<style>
text {
font: 14px sans-serif;
}
body {
font: sans-serif;

This example demonstrates how to prevent D3’s force layout from moving nodes that have been repositioned by the user. When the force layout’s drag behavior dispatches a dragstart event, the fixed property of the dragged node is set to true. This prevents the force layout from subsequently changing the position of the node (due to forces). Double-click to release a node.

Internally, the force layout uses three bits to control whether a node is fixed. The first bit can be set externally, as in this example. The second and third bits are set on mouseover and mousedown, respectively, so that nodes are fixed temporarily during dragging. Although the second and third bits are automatically cleared when dragging ends, the first bit stays true in this example, and thus nodes remain fixed after dragging.

Also note that the force layout resumes au

@trinary
trinary / keybase.md
Created July 18, 2014 19:56
keybase proof.

Keybase proof

I hereby claim:

  • I am trinary on github.
  • I am trinary (https://keybase.io/trinary) on keybase.
  • I have a public key whose fingerprint is 43E9 A3A0 7D42 CE6D 7532 07E5 49FC 02BD E86B 6333

To claim this, I am signing this object:

@trinary
trinary / _.md
Created July 20, 2014 21:07
Simple annotation
@trinary
trinary / _.md
Created July 20, 2014 21:32
Custom shapes
@trinary
trinary / _.md
Created August 13, 2014 20:43
Tributary inlet
@trinary
trinary / _.md
Created November 23, 2014 23:09
stupid text
@trinary
trinary / _.md
Last active August 29, 2015 14:10
2 level binding
@trinary
trinary / _.md
Created December 23, 2014 20:12
Tributary inlet
@trinary
trinary / _.md
Created January 26, 2015 19:01
Tributary inlet