Skip to content

Instantly share code, notes, and snippets.

View siddharthpolisiti's full-sized avatar

siddharthpolisiti

View GitHub Profile
1
00:01:21,047 --> 00:01:22,787
MAN: Yes.
2
00:01:58,384 --> 00:02:06,384
Yes.
3
00:02:45,632 --> 00:02:47,933

d3js Multiline chart with brushing and mouseover

import java.util.ArrayList;
import java.util.List;
public class FlattenArrays {
List<Integer> temp = new ArrayList<Integer>();
public int[] flatArray(Object[] input){
if(input.getClass().isArray()){
for(int i=0;i<input.length;i++){
if(!input[i].getClass().isArray()){
temp.add((Integer) input[i]);
@siddharthpolisiti
siddharthpolisiti / README.md
Last active December 26, 2016 18:49 — forked from rkirsling/LICENSE
Directed Graph Editor

Click in the open space to add a node, drag from one node to another to add an edge.
Ctrl-drag a node to move the graph layout.
Click a node or an edge to select it.

When a node is selected: R toggles reflexivity, Delete removes the node.
When an edge is selected: L(eft), R(ight), B(oth) change direction, Delete removes the edge.

To see this example as part of a larger project, check out Modal Logic Playground!

@siddharthpolisiti
siddharthpolisiti / ageSorter.js
Last active November 28, 2016 08:40
The program is to sort objects based upon the array object with key age.
var arr=[{name:"sidd",age:26},{name:"john",age:30},{name:"gary",age:20}];
function compare(a,b) {
if (a.age < b.age)
return -1;
if (a.age > b.age)
return 1;
return 0;
}
@siddharthpolisiti
siddharthpolisiti / flatArray.js
Last active September 26, 2016 10:44
This program converts nested arrays to flat array structure
// JSBIN link - http://jsbin.com/wedoqeyezi/edit?js,output (EDIT - http://jsbin.com/kuvepo/edit?js,console)
// The below works because the first iteration find this elements and checks whether they are array or not if not then it simply
// pushes the element to the flatArray else if they are array they are sent to recursive function for further processing till a
// value(not array) is reached and then finally pushed to flatArray.
var arr = [[1,2,[3]],4];
flatArray = [];
for(var i=0;i<arr.length;i++){
if(arr[i].length === undefined){
flatArray.push(arr[i]);
}
@siddharthpolisiti
siddharthpolisiti / README.markdown
Last active July 28, 2016 05:45 — forked from bewest/README.markdown
d3 several time scales ~bewest

Time scales

This demo several time scales. src

full screen demo

D3's time axis does magic things. I expected to modify the x axis such that I could mostly re-use D3's date formatting tricks, but exercise greater control over the resolution at different time scales.

@siddharthpolisiti
siddharthpolisiti / index.html
Last active May 24, 2016 14:13
Bar and Line Chart for Temperature Comparision (Daringbadi vs Titlagarh) from (2007 - 16)
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
body {
font: 10px sans-serif;
}
@siddharthpolisiti
siddharthpolisiti / index.html
Last active May 12, 2016 12:43
MultiLine Chart with legends and tooltips
<!DOCTYPE html>
<meta charset="utf-8">
<head>
<style>
body {
font: 10px sans-serif;
}
@siddharthpolisiti
siddharthpolisiti / index.html
Last active September 5, 2017 12:10
Max-Min-Avg Chart
<!DOCTYPE html>
<meta charset="utf-8">
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {