Skip to content

Instantly share code, notes, and snippets.

View htaghizadeh's full-sized avatar

Hossein Taghi-Zadeh htaghizadeh

View GitHub Profile
@fredrik
fredrik / centrality.py
Created October 19, 2010 09:27
calculate centrality measures for a network using networkx
#!/usr/bin/env python
import networkx as nx
# for each node:
# + degree centrality
# + closeness centrality
# + betweenness centrality
# + eigenvector centrality
# + page rank
@mbostock
mbostock / .block
Last active April 23, 2024 12:30
Hierarchical Edge Bundling
license: gpl-3.0
height: 960
border: no
redirect: https://observablehq.com/@d3/hierarchical-edge-bundling
@dharnan
dharnan / jquery-dynamic-form.js
Last active October 20, 2022 13:39
jQuery Dynamic Form
/*
* 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
*
@bluepapa32
bluepapa32 / build.gradle
Created December 22, 2011 17:50
Apache Solr DEMO with Gradle
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 {
@ssajous
ssajous / Dice.cs
Last active October 14, 2021 15:41
Implementations of Dice's Coefficient used to get a similarity index between two strings.
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);
#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"]
}
$OutputEncoding = New-Object -typename System.Text.UTF8Encoding
[Console]::OutputEncoding = New-Object -typename System.Text.UTF8Encoding
@sloria
sloria / bobp-python.md
Last active April 17, 2025 08:09
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@mef
mef / pre-render.js
Last active May 20, 2022 16:56
proof-of-concept pre-rendering d3.js svgs on the server using node.js and jsdom module.
// 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) {
@robschmuecker
robschmuecker / README.md
Last active March 28, 2025 14:54
D3.js Drag and Drop, Zoomable, Panning, Collapsible Tree with auto-sizing.

This example pulls together various examples of work with trees in D3.js.

The panning functionality can certainly be improved in my opinion and I would be thrilled to see better solutions contributed.

One can do all manner of housekeeping or server related calls on the drop event to manage a remote tree dataset for example.

Dragging can be performed on any node other than root (flare). Dropping can be done on any node.

Panning can either be done by dragging an empty part of the SVG around or dragging a node towards an edge.