Skip to content

Instantly share code, notes, and snippets.

@ngopal
ngopal / index.html
Created December 5, 2014 20:25
// source http://jsbin.com/repehi // a weak attempt at implementing a barebones category theory library in javascript.
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example</title>
<style>
body {
height: 3000px;
}
.dot {
@ngopal
ngopal / visual_encodings.json
Created May 4, 2015 21:13
visual encodings
[
{
"Encoding" : "placement-position",
"Ordered" : "true",
"UsefulVales" : "inf",
"Quantitative" : "true",
"Ordinal" : "true",
"Categorical" : "true",
"Relational" : "true"
},
@ngopal
ngopal / index.html
Last active August 29, 2015 14:22
Just making silly pretty pictures. I guess you might be able to learn a thing or two about D3 transitions if you don't already know how they work.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>title</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<script type="text/javascript">
var margin = {"left":20, "top":10, "right":20, "bottom":20}
@ngopal
ngopal / force-directed.js
Created September 10, 2015 21:18
Working on a simply implemented force-directed layout implementation
//constants
var K_r = 60;
var L = 50;
var delta_t = 0.4;
var MAX_DISP_SQ = 20;
var width = 300;
var height = width;
var body = d3.select('body');
@ngopal
ngopal / MyVariantUIPrototype.js
Created September 15, 2015 23:57
A rapid prototype for an interface for MyVariant.info JSON data
var myvar = {
"hits": [
{
"_id": "chr1:g.218631822G>A",
"_score": 17.48471,
"dbsnp": {
"allele_origin": "unspecified",
"alleles": [
{
"allele": "G",
@ngopal
ngopal / RandomNetwork.js
Created September 22, 2015 21:02
Some functions to generate a random network. Returned objected is ready for plug-and-play use with D3 force-directed graph examples
function initializeNodes(n) {
var arr = [];
for (var i = 0; i < n; i++) {
arr.push({id:i});
}
return arr;
}
function getRandomArbitrary(min, max) {
@ngopal
ngopal / CIE1931xy_blank.svg
Last active October 23, 2015 23:04
Posting a github repo as a gist to include it on a webpage in an iframe
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ngopal
ngopal / index.html
Created November 4, 2015 04:14
quick one-off script to visualize a sif format file in D3
<html>
<head>
<style>
.node {
stroke: #fff;
stroke-width: 1.5px;
}
.link {
@ngopal
ngopal / graph_edges.csv
Created December 2, 2015 19:45
A gist showing how to setup a small multiple implementation of a basic D3 force directed graph. The code also contains an example of how to read in a CSV file that contains graph edges. The JSBIN example lives here: http://jsbin.com/hinixi/2
source target
A1 A2
A2 A3
A2 A4