Skip to content

Instantly share code, notes, and snippets.

@timkg
timkg / README.md
Created March 22, 2014 05:40 — forked from mbostock/.block

A sunburst is similar to the treemap, except it uses a radial layout. The root node of the tree is at the center, with leaves on the circumference. The area (or angle, depending on implementation) of each arc corresponds to its value. Sunburst design by John Stasko. Data courtesy Jeff Heer.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
var myObj = {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
// Closure - transporting a function outside of another function's scope. The returned function keeps reference to the inner scope, even when it is used somewhere else.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<p>Most object-oriented languages are actually class-based.</p>
<p>Javascript is object-oriented in the sense that you can create Objects without Classes.</p>
<p>Every Object in JS is created via a Constructor, implicitly or explicitly.</p>
@timkg
timkg / gist:309a6d12741638c486be
Created March 24, 2015 04:07
Map-Reduce a collection of values into a list
[1, 2, 3]
.map(function (num) {
var listItem = document.createElement('li');
listItem.textContent = num;
return listItem;
})
.reduce(function (acc, cur) {
acc.appendChild(cur);
return acc;
}, document.createElement('ul'));
from game import Directions
n = Directions.NORTH
s = Directions.SOUTH
w = Directions.WEST
e = Directions.EAST
fringe = util.Stack()
closed = set()
def makeNode(state, prevActions=[], action=False):