Skip to content

Instantly share code, notes, and snippets.

@jueyang
jueyang / index.js
Last active August 29, 2015 14:02
Gist from mistakes.io: explaining different d3.scale()
"hello, world"; // edit this to begin
require('http://d3js.org/d3.v3.min.js');
// equal interval
var color1 = d3.scale.quantize()
.domain([0,10]) // continuous
.range(["#000", "#111", "#222", "#333", "#444", "#555"]);
// manual interval
@jueyang
jueyang / index.html
Created June 3, 2014 23:08
Leaflet choreopleth example
<!DOCTYPE HTML>
<html>
<head>
<title>Leaflet with a layer of United States</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
</head>
<body>
<h1>I am a leaflet map with <span>OpenStreetMap</span> tiles, using my own <span>L.geoJson()</span> method.</h1>
<div id="map" class="map"></div>
@jueyang
jueyang / Makefile
Last active August 29, 2015 14:04
Illinois Geographies
TOPOJSON = node_modules/.bin/topojson
GENERATED_FILES = \
topo/il_cbsa.json \
topo/il_counties.json \
topo/il_tracts_2010.json \
topo/il_tracts_2000.json \
topo/il_places.json \
topo/il_congressional.json \
topo/il_senate.json \
@jueyang
jueyang / index.html
Created July 22, 2014 21:42
Talking about topojson at SRCCON
<!DOCTYPE html>
<html>
<head>
<title>Foo</title>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' />
<link href='http://fonts.googleapis.com/css?family=Inconsolata:400,700' rel='stylesheet' type='text/css'>
<style type='text/css'>
body {
SRCCON COFFEE HACK STATION EQUIPMENT
================================
Grinders
------------
2x Mr Coffee Burr Grinders
2x Hairo Coffee Mill Slim
[
// the following is a sample of a donor country
{'name': 'core_total', 'value':10000,'donor-country':'JPN'}, // from core-fund.csv, the sum of all core contribution
{'name': 'noncore_total', 'value': 50000,'donor-country':'JPN'}, // from fund-modality.csv, the sum of all 5 types of funding
{'name': 'cost_sharing', 'value': 10000, 'donor-country':'JPN'}, // from fund-modality.csv, sum of the respective type
{'name': 'thematic_trust_funds', 'value': 10000, 'donor-country':'JPN'},
{'name': 'trust_funds', 'value': 10000, 'donor-country':'JPN'},
{'name': 'special_activities', 'value': 10000, 'donor-country':'JPN'},
{'name': 'unv', 'value': 10000, 'donor-country':'JPN'},
...
<!DOCTYPE html>
<head>
<meta charset='utf-8'>
</head>
<style>
body {
margin:0;
padding:20px;
}
section {
@jueyang
jueyang / github-gui.md
Created October 15, 2014 15:58
A step-by-step guide to use Github GUI
  1. Download and sign in the Github application. https://help.github.com/articles/getting-started-with-github-for-windows/
  2. In this case, the github repo already exists on github, you need to add it to your local machine. To do this, go to the top-left corner and you see a plus sign that indicates repo addition.
  • Click the plus sign and choose Clone. This will show you a list of repos available under your account.
  • Click the repo and confirm by clicking Clone Repository. A window will pop up and ask you where you would like to put your repo. You can use whatever path you prefer. Once the repo is cloned, changes in that folder will be tracked (which is what git does).
  1. Now you have the repository as a local folder. You can add/edit/delete files from the folder. In the demo, a new folder is a added along with a new image in it.
  1. Once you are done with the folder, go back to the GitHub
@jueyang
jueyang / index.html
Last active August 29, 2015 14:10
Index template
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
</head>
<!-- your html content here -->
</html>