- Platform: Browser
- https://github.com/organizations/{ORGNAME}/dashboard/issues
- Platform: Browser
#!/bin/env python | |
""" | |
os.walk is an awesome generator. | |
However, I needed the same functionality, | |
only I wanted to walk 'up' the | |
directory tree. | |
This allows seaching for files | |
in directories directly above |
# To check if this is up-to-date with the tax rates go to | |
# http://www.expatax.nl/tax-rates-2016.php and see if there's anything | |
# newer there. | |
# | |
# I make no guarantees that any of this is correct. I calculated this | |
# at the time and have been updating it when new tax rates come along | |
# because people keep finding this useful. | |
# | |
# There's also an interactive JS version of this created by | |
# @stevermeister at |
license: apache-2.0 |
license: gpl-3.0 |
curl -XDELETE 'localhost:9200/jsonld' | |
curl -XPOST 'localhost:9200/jsonld' | |
curl -XPUT 'localhost:9200/jsonld/doc/1' -d ' | |
{ | |
"@context": | |
{ | |
"dc": "http://purl.org/dc/elements/1.1/", |
d3.js's force layout works fine with index-based node references in links, since it substitutes them internally with the corresponding node from the nodes
array. This simple approach is effective when we can refer to nodes by their index in the nodes
array. But what if we have an ID for each node and we want links to refer to those IDs?
If we resolve the IDs into nodes before passing them to d3.js's force layout, everything works as expected. This example illustrates the technique by repurposing another example by Mike Bostock.
Each node is given a string ID (a letter), and each link uses them to refer to the nodes it connects to. The code iterates through the links
array to resolve the references.
Like in the original example, nodes are placed in precomputed positions, are made draggable, and are made fixed (i.e. not subject to the force) when dragged.
#http://docs.python.org/2.7/library/csv.html | |
import csv, codecs, cStringIO | |
class UTF8Recoder: | |
""" | |
Iterator that reads an encoded stream and reencodes the input to UTF-8 | |
""" | |
def __init__(self, f, encoding): | |
self.reader = codecs.getreader(encoding)(f) |
{ | |
"graph": [], | |
"links": [ | |
{"source": 0, "target": 1}, | |
{"source": 0, "target": 2}, | |
{"source": 0, "target": 3}, | |
{"source": 0, "target": 4}, | |
{"source": 0, "target": 5}, | |
{"source": 0, "target": 6}, | |
{"source": 1, "target": 3}, |