Friday, July 25, 2014

d3.js - Hello World

<!DOCTYPE html>
<html>
<head>
<!-- d3 uses extended ascii characters, so we HAVE to specify utf-8 -->
<meta charset="utf-8">
<script type="text/javascript" language="javascript" src="d3.v3.js"></script>
</head>
<body>
<script type="text/javascript">
// 1. Select a DOM element with a CSS selector
// 2. Create (and append) a new p DOM element, append it to body
// 3. Set the text of the DOM element p, to "Hello World!"
d3.select("body").append("p").text("Hello World!");
</script>
</body>
</html>

Sublime Text on MAC -


Go to end of line/begin of line, and select to end of line, begin of line defaults were driving me crazy. I wan home to move to begin of line, and end to go to end of line - not begin/end of document. Same deal for shift+home and shift+end - I want to select to begin/end of line.

Here's how to "fix" it - just add this to the keymaps.
{ "keys": ["home"], "command": "move_to", "args": {"to": "bol"} },
{ "keys": ["end"], "command": "move_to", "args": {"to": "eol"} },
{ "keys": ["shift+home"], "command": "move_to", "args": {"to": "bol", "extend": true} },
{ "keys": ["shift+end"], "command": "move_to", "args": {"to": "eol", "extend": true} },