Skip to content

Instantly share code, notes, and snippets.

@jimkang
jimkang / Contract Killer 3.md
Last active September 19, 2024 18:10
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@jimkang
jimkang / index.html
Last active July 6, 2016 13:21 — forked from anonymous/index.html
Rendering grouped data.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Rendering grouped data</title>
<style id="jsbin-css">
body {
font-family: 'Proxima Nova', 'Helvetica Neue', sans-serif;
}
@jimkang
jimkang / index.html
Last active August 29, 2015 14:01 — forked from mbostock/.block
A bounded force-directed graph layout with "gravity" at the bottom of the bounds and collision detection/reaction among the nodes.
<!DOCTYPE html>
<html>
<head>
<title>Ball drop with force-directed layout and collision detection</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style type="text/css">
circle {
stroke-width: 1.5px;
}
@jimkang
jimkang / README.md
Created March 28, 2014 19:17 — forked from mbostock/.block

This demonstrates finding the closest point to the mouse by searching a quadtree. As you descend into the quadtree, you track the closest point yet found and avoid searching cells that cannot contain closer points. Importantly, you must descend preferentially into closer cells so as to restrict the search more quickly.

Patrick Surry implemented a similar solution months earlier!

@jimkang
jimkang / README.md
Last active December 30, 2015 17:59 — forked from mbostock/.block

This example, using satirical data from The Onion, demonstrates how to wrap long axis labels to fit on multiple lines.

Update (jimkang): Added a data accessor function as a parameter to mbostock's wrap() so that it can fetch the text from the data source rather than using text().

The problem with text() is that it is built on textContent which "returns the text content of this node and its descendants." If a text element has several tspan descendants, it joins their contents without spaces. e.g. a text element with three tspans each containing 'why', 'are', and 'we' will give back 'whyarewe' through text(). The rest of wrap will proceed to treat that as one word, naturally.

This becomes an issue when wrap() is called multiple times on text elements that have already been processed by wrap().

@jimkang
jimkang / README.md
Last active December 16, 2015 11:19 — forked from mbostock/.block

Click to add new points. Hit the DELETE key to remove the selected point. Use the dropdown menu to change the interpolation mode.

Updated from mbostock's original gist to allow editing the coordinates in text fields.