Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
path { stroke: red; fill: none; stroke-width:2; opacity: 0.4} | |
</style> | |
</head> |
""" | |
Original Author Ernesto P. Adorio, Ph.D | |
Original Source: http://my-other-life-as-programmer.blogspot.com/2012/02/python-finding-nearest-matching-color.html | |
Modifed By: JDiscar | |
This class maps an RGB value to the nearest color name it can find. Code is modified to include | |
ImageMagick names and WebColor names. | |
1. Modify the minimization criterion to use least sum of squares of the differences. | |
2. Provide error checking for input R, G, B values to be within the interval [0, 255]. |
license: gpl-3.0 | |
height: 800 |
(function(){ | |
var i = 0; | |
var count = $('.Album.unavailable,.Album.preview').length; | |
console.log('Found ' + count + ' albums to remove'); | |
var timeout = 0; | |
$('.Album.unavailable,.Album.preview').each(function(){ | |
var instance_i = i++; | |
var album = $(this); | |
album.trigger('mouseover').mouseenter(); | |
album.find('a,div,span,image').trigger('mouseover').mouseenter(); |
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE Map [ | |
<!-- compositing mode: https://github.com/mapnik/mapnik/blob/master/include/mapnik/image_compositing.hpp#L42-79 --> | |
<!ENTITY comp_op "darken"> | |
<!-- leave blank to render all data or set to some integer to render faster --> | |
<!ENTITY row_limit ""> | |
<!-- size of marker ellipse --> |
license: gpl-3.0 | |
redirect: https://observablehq.com/@d3/margin-convention |
try: | |
import simplejson as json | |
except ImportError: | |
try: | |
import json | |
except ImportError: | |
raise ImportError | |
import datetime | |
from bson.objectid import ObjectId | |
from werkzeug import Response |
'''Provides utility functions for encoding and decoding linestrings using the | |
Google encoded polyline algorithm. | |
''' | |
def encode_coords(coords): | |
'''Encodes a polyline using Google's polyline algorithm | |
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html | |
for more information. | |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!