A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
// pre-render d3 charts at server side | |
var d3 = require('d3') | |
, jsdom = require('jsdom') | |
, fs = require('fs') | |
, htmlStub = '<html><head></head><body><div id="dataviz-container"></div><script src="js/d3.v3.min.js"></script></body></html>' | |
jsdom.env({ | |
features : { QuerySelector : true } | |
, html : htmlStub | |
, done : function(errors, window) { |
$OutputEncoding = New-Object -typename System.Text.UTF8Encoding | |
[Console]::OutputEncoding = New-Object -typename System.Text.UTF8Encoding |
#create a test index with shingle mapping | |
curl -XPUT localhost:9200/test -d '{ | |
"settings":{ | |
"index":{ | |
"analysis":{ | |
"analyzer":{ | |
"analyzer_shingle":{ | |
"tokenizer":"standard", | |
"filter":["standard", "lowercase", "filter_stop", "filter_shingle"] | |
} |
public static double DiceCoefficient(string stOne, string stTwo) | |
{ | |
HashSet<string> nx = BuildBigramSet(stOne); | |
HashSet<string> ny = BuildBigramSet(stTwo); | |
HashSet<string> intersection = new HashSet<string>(nx); | |
intersection.IntersectWith(ny); | |
double dbOne = intersection.Count; | |
return (2 * dbOne) / (nx.Count + ny.Count); |
import org.apache.solr.common.* | |
import org.apache.solr.client.solrj.* | |
import org.apache.solr.client.solrj.impl.* | |
import org.apache.solr.client.solrj.response.* | |
basename = "apache-solr-3.5.0" | |
baseurl = "http://ftp.jaist.ac.jp/pub/apache/lucene/solr/3.5.0" | |
serverurl = "http://localhost:8983/solr" | |
buildscript { |
/* | |
* jquery.dynamicForm.js | |
* Arietis Software | |
* www.arietis-software.com | |
* 2009 | |
* version: 1.1 | |
* ---------------------------- | |
* Distributed under the GNU General Public License | |
* http://www.arietis-software.com/license/gnu/license.txt | |
* |
license: gpl-3.0 | |
height: 960 | |
border: no | |
redirect: https://observablehq.com/@d3/hierarchical-edge-bundling |
#!/usr/bin/env python | |
import networkx as nx | |
# for each node: | |
# + degree centrality | |
# + closeness centrality | |
# + betweenness centrality | |
# + eigenvector centrality | |
# + page rank |