Skip to content

Instantly share code, notes, and snippets.

@milkbread
milkbread / index.html
Created June 17, 2013 13:40
JavaScript: JS-objects a simple example
<script>
var body = d3.select('body');
var an_object = {key1:"value1", key2:"value2"}
body.append("text").text("1: ",an_object['key1'])
body.append("text").text("2: ",an_object.key1)
for (one_key in an_object){
@milkbread
milkbread / readme.md
Last active July 24, 2022 22:16
MD: Readme.md styling test

How to structure a readme file

Tutorial and cheat sheet in one file!

Headings are indicated by one or more #hashtags, while...

... it is getting smaller, and smaller...

Add a line by just adding 3 hyphens

@milkbread
milkbread / RKAggregation_1.0.js
Last active December 18, 2015 13:49
HTML: D3-tutorial 1 - zoombar
function RKAggregation_version(){
return "0.1.0"
}
//***********************
//Aggregation - 'Objects'
//object that defines and administrates a polygonal feature
//Object-definition -- Feature-Object ... contains all necessary functions and variables of one feature:
@milkbread
milkbread / index.html
Last active December 18, 2015 13:48
HTML: D3-tutorial 1 - basics
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<style>
#text{
font-size:24;
}
</style>
</head>
<body>
@milkbread
milkbread / index.html
Last active December 18, 2015 12:19
HTML: Clipping 1st running demo
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
<!--<script src="https://gist.github.com/milkbread/5713629/raw/RKMapping_0.4.js"></script>-->
<script src="http://bl.ocks.org/milkbread/raw/5779939/RKMapping_0.4.js"></script>
@milkbread
milkbread / RKMapping_0.4.4.js
Created June 14, 2013 06:46
JavaScript: RKMapping all files
//adding an overlay to an existing leaflet map object
function mapOverlay(map_){
this.map=map_;
this.overlaySVG = d3.select(this.map.getPanes().overlayPane).append("svg");
this.overlay=this.overlaySVG.append("g").attr("class", "leaflet-zoom-hide")
var path_geo = d3.geo.path().projection(project);
//necessary for zooming the map...corresponded to: map.on("viewreset", reset);
this.resetView=resetView;
function resetView(bounds_map_){
var bottomLeft = project(bounds_map_[0]),
@milkbread
milkbread / RKMapping_0.4.js
Last active December 18, 2015 09:49
HTML: simple arc-aggregation demonstration
//adding an overlay to an existing leaflet map object
function mapOverlay(map_){
this.map=map_;
this.overlaySVG = d3.select(this.map.getPanes().overlayPane).append("svg");
this.overlay=this.overlaySVG.append("g").attr("class", "leaflet-zoom-hide")
var path_geo = d3.geo.path().projection(project);
//necessary for zooming the map...corresponded to: map.on("viewreset", reset);
this.resetView=resetView;
function resetView(bounds_map_){
var bottomLeft = project(bounds_map_[0]),
@milkbread
milkbread / vg250_clipped2_topo.json
Last active December 18, 2015 08:29
TopoJSON: Data examples I
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@milkbread
milkbread / index.html
Last active December 18, 2015 08:29
HTML: Testing the linking of external scripts and files
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.5.1/leaflet.js"></script>
<script type="text/plain" src="https://raw.github.com/square/crossfilter/master/crossfilter.min.js"></script>
<script src="milkbread/raw/5727801/testfunction.js"></script>
@milkbread
milkbread / RKToolbox.js
Last active December 18, 2015 07:00
HTML: Slider example
//SLIDER - 1 indicator
function slider(container,width,height){
//initialize some variables
var indicWidth = 12, clickListenerTest=false, hoverListenerTest=false, clickListener, hoverListener, indicPos = width/2;
var indicatorStartPosition = 0;
var axisScale = d3.scale.linear();
var sliderSVG = container.append("svg")
.attr("width", width)