Skip to content

Instantly share code, notes, and snippets.

View kanitw's full-sized avatar

Kanit Wongsuphasawat kanitw

View GitHub Profile
@kanitw
kanitw / .block
Last active February 23, 2018 05:22 — forked from domoritz/.block
Vega-Lite Bl.ocks example
license: bsd-3-clause
@kanitw
kanitw / .block
Last active October 5, 2017 16:46
Vega-Lite block example
license: bsd-3-clause
@kanitw
kanitw / Layer.vl.json
Last active August 4, 2017 16:36
Vega-lite Quick Demo
{
"$schema": "https://vega.github.io/schema/vega-lite/v2.json",
"description": "Summarized and per year weather information for Seatle and New York.",
"data": {"url": "data/weather.csv"},
"repeat": {"column": ["temp_max","precipitation","wind"]},
"spec": {
"layer": [
{
"mark": "line",
"encoding": {
[{
"Year": 1955,
"Country": "Afghanistan",
"Region": "South Asia",
"Population": 8891209,
"Life Expectancy": 30.332,
"Fertility": 7.7
}, {
"Year": 1960,
"Country": "Afghanistan",
name economy (mpg) cylinders displacement (cc) power (hp) weight (lb) 0-60 mph (s) year
AMC Ambassador Brougham 13 8 360 175 3821 11 73
AMC Ambassador DPL 15 8 390 190 3850 8.5 70
AMC Ambassador SST 17 8 304 150 3672 11.5 72
AMC Concord DL 6 20.2 6 232 90 3265 18.2 79
AMC Concord DL 18.1 6 258 120 3410 15.1 78
AMC Concord DL 23 4 151 3035 20.5 82
AMC Concord 19.4 6 232 90 3210 17.2 78
AMC Concord 24.3 4 151 90 3003 20.1 80
AMC Gremlin 18 6 232 100 2789 15 73
[
{"x": 1, "cat": null},
{"x": 1, "cat": null},
{"x": 1, "cat": null},
{"x": 1, "cat": null},
{"x": 2, "cat": "a"},
{"x": 3, "cat": 1},
{"x": 2, "cat": 1},
{"x": 2, "cat": null},
{"x": 2, "cat": "b"},
@kanitw
kanitw / filtered_line.json
Created April 15, 2016 22:17 — forked from willium/filtered_line.json
vega label specs
{
"width": 1,
"height": 1,
"padding": "auto",
"data": [
{
"name": "source",
"url": "data/stocks.csv",
"format": {
"type": "csv",
@kanitw
kanitw / README.md
Last active January 4, 2016 08:09 — forked from mbostock/.block

This simple force-directed graph shows character co-occurence in Les Misérables. A physical simulation of charged particles and springs places related characters in closer proximity, while unrelated characters are farther apart. Layout algorithm inspired by Tim Dwyer and Thomas Jakobsen. Data based on character coappearence in Victor Hugo's Les Misérables, compiled by Donald Knuth.

Compare this display to a force layout with curved links, a force layout with fisheye distortion and a matrix diagram.

Forked from Mike Bostock http://bl.ocks.org/mbostock/4062045 and resized!

@kanitw
kanitw / 0_reuse_code.js
Created November 7, 2013 17:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kanitw
kanitw / peerapi-answers-template.html
Last active December 17, 2015 18:29
peerapi-answers-template
<script src="https://learningapi.stanford.edu/static/js/checkboxes.js"></script>
<div class='answers' data-max-score='1' data-min-score='0'>
<p>Long/full answers description</p>
<b>Correct Answers</b>
<ul class='correct-answers' data-add-other='true'>
<li data-score='1'>Correct Answer 1</li>
...
<!--To add/remove other choice, modify data-add-other attribute in the ul tag-->