Skip to content

Instantly share code, notes, and snippets.

View pravj's full-sized avatar
📖

Pravendra Singh pravj

📖
View GitHub Profile
/*
Hide radio button (the round disc)
we will use just the label to create pushbutton effect
*/
input[type=radio] {
display:none;
margin:10px;
}
/*
@pravj
pravj / NBA-CHA-TOR-event.json
Created February 16, 2017 19:09
Data for an event in the NBA game between Toronto Raptors and Charlotte Hornets
[{"eventId": "6", "visitor": {"abbreviation": "CHA", "players": [{"playerid": 101107, "lastname": "Williams", "jersey": "2", "firstname": "Marvin", "position": "F"}, {"playerid": 203087, "lastname": "Lamb", "jersey": "3", "firstname": "Jeremy", "position": "G"}, {"playerid": 201587, "lastname": "Batum", "jersey": "5", "firstname": "Nicolas", "position": "G-F"}, {"playerid": 202391, "lastname": "Lin", "jersey": "7", "firstname": "Jeremy", "position": "G"}, {"playerid": 1626151, "lastname": "Harrison", "jersey": "9", "firstname": "Aaron", "position": "G"}, {"playerid": 202689, "lastname": "Walker", "jersey": "15", "firstname": "Kemba", "position": "G"}, {"playerid": 203798, "lastname": "Hairston", "jersey": "19", "firstname": "PJ", "position": "F-G"}, {"playerid": 203148, "lastname": "Roberts", "jersey": "22", "firstname": "Brian", "position": "G"}, {"playerid": 203584, "lastname": "Daniels", "jersey": "30", "firstname": "Troy", "position": "G"}, {"playerid": 203469, "lastname": "Zeller", "jersey": "40", "first
@pravj
pravj / gron-fork.md
Last active January 1, 2017 06:42
development of gron-fork
  • type of stop channel to bool, less bytes?
  • graceful shutdown of the cron instance
@pravj
pravj / clustering.py
Last active December 19, 2016 09:07
Used in the post "Point clustering using Python" (http://moderndata.plot.ly/point-clustering-in-python/)
import sys
import math
import random
"""
Point clustering using Python [http://moderndata.plot.ly/point-clustering-in-python/]
This is an improved version of the KMeans Clustering Algorithmn
Which was originally implemented by 'Ian Danforth'.
[Reference: https://gist.github.com/iandanforth/5862470]
@pravj
pravj / zap_handler_app.go
Last active May 29, 2016 17:16
Sample application to demonstrate the working of "http.Handler" feature in "uber-go/zap".
// Author: Pravendra Singh (pravj)
// Reference: https://github.com/uber-go/zap/pull/71
// It can be viewed as an application which is trying to load its configurations initially.
// So the log level is `Debug` in starting. The application is emitting both `Info` and `Debug` messages.
// Once the config files are distributed perfectly (simulated by time.Sleep).
// It makes a http request using the provided `Handler` and the log level is changed to `Info`.
// After that the `Debug` messages are ignored.
package main
@pravj
pravj / octogrid_basic.py
Last active November 29, 2017 11:26
The basic version of "octogrid", to visualize communities in GitHub following network
import igraph as ig
import plotly.plotly as py
from plotly.graph_objs import *
G = ig.Graph.Read_GML('network.gml')
labels = list(G.vs['label'])
N = len(labels)
E = [e.tuple for e in G.es]
@pravj
pravj / gauge-post.R
Last active June 13, 2017 21:52
Source code for the post "Gauge charts in R and Python" [R version]
library(plotly)
base_plot <- plot_ly(
type = "pie",
values = c(40, 10, 10, 10, 10, 10, 10),
labels = c("-", "0", "20", "40", "60", "80", "100"),
rotation = 108,
direction = "clockwise",
hole = 0.4,
textinfo = "label",
@pravj
pravj / karate.gml
Last active September 7, 2016 03:12
GML format of "Zachary's Karate Club" social network.[W. W. Zachary, An information flow model for conflict and fission in small groups, Journal of Anthropological Research 33, 452-473 (1977)]
Creator "Mark Newman on Fri Jul 21 12:39:27 2006"
graph
[
node
[
id 1
label "1"
]
node
[
@pravj
pravj / Guide.md
Last active December 27, 2015 18:30

Hi there,

For the map 'From where does India shops?'

Stylesheet and Javascript

You need to add these css and js script in the header section of the HTML.

<script src='https://api.mapbox.com/mapbox.js/v2.2.1/mapbox.js'></script>
This file has been truncated, but you can view the full file.
var statesData = {"type": "FeatureCollection", "features": [{"geometry": {"type": "MultiPolygon", "coordinates": [[[[93.787727, 6.85264], [93.78849, 6.852571], [93.789047, 6.852571], [93.789047, 6.852291], [93.789673, 6.852291], [93.789879, 6.852013], [93.790154, 6.851945], [93.790642, 6.851667], [93.790779, 6.851389], [93.790916, 6.851042], [93.790504, 6.850625], [93.790291, 6.850347], [93.790001, 6.850279], [93.789482, 6.849903], [93.789001, 6.849485], [93.788376, 6.849137], [93.788017, 6.84872], [93.787781, 6.848056], [93.787506, 6.848061], [93.787216, 6.847781], [93.786392, 6.847781], [93.78611, 6.848061], [93.785278, 6.848061], [93.784439, 6.8489], [93.784447, 6.849166], [93.785492, 6.84993], [93.786255, 6.850625], [93.786766, 6.851172], [93.786942, 6.851671], [93.787376, 6.851667], [93.787376, 6.852084], [93.787308, 6.852359], [93.787376, 6.852571], [93.787727, 6.85264]]], [[[93.719582, 7.207501], [93.719582, 7.20687], [93.719307, 7.20646], [93.718819, 7.206391], [93.718262, 7.20653], [93.717499, 7.2069