Skip to content

Instantly share code, notes, and snippets.

@Peege151
Peege151 / topojson
Created April 17, 2015 23:40
Trying to follow the guide here: http://datamaps.markmarkoh.com/using-custom-map-data-w-datamaps/ but not getting the right output from the queries to topojson and ogr2ogr
{"type":"Topology","objects":{"subunits":{"type":"GeometryCollection","geometries":[{"type":"Polygon","arcs":[[0]]}]}},"arcs":[[[7332,9927],[5,1],[5,3],[9,0],[8,-2],[20,-13],[27,-24],[42,-56],[58,-30],[23,-19],[17,-33],[4,-49],[-3,-25],[-13,-47],[-4,-32],[-13,-32],[-10,-45],[-20,-48],[-5,-28],[-7,-25],[-1,-12],[3,-14],[3,-2],[6,2],[7,-2],[26,-27],[15,-8],[14,10],[13,12],[84,37],[25,-2],[21,-18],[21,-33],[-5,-8],[2,-13],[1,-24],[0,-26],[-3,-20],[-11,-19],[-25,-21],[-6,-20],[1,-10],[6,-24],[2,-12],[-1,-11],[-8,-34],[-3,-34],[-2,-11],[-4,-9],[-8,-15],[-3,-6],[-3,-48],[10,-89],[-7,-44],[-7,-25],[-3,-15],[6,-43],[1,-46],[-2,-23],[-4,-14],[-1,-31],[-25,-55],[2,-27],[-5,-10],[-4,-16],[-5,-45],[-1,-67],[1,-13],[4,-12],[12,-24],[3,-13],[0,-45],[2,-24],[6,-20],[39,-81],[7,-22],[5,-51],[5,-22],[8,-21],[9,-19],[23,-31],[30,-20],[32,-9],[34,0],[34,8],[27,14],[201,191],[19,26],[23,17],[6,8],[10,20],[7,10],[28,23],[70,37],[31,8],[48,-11],[24,15],[103,19],[6,11],[4,21],[29,57],[33,86],[20,36],[28,21],[32,8],[18,8],[15,23],[4
@Peege151
Peege151 / fail_sort
Created March 6, 2015 22:46
failing sort
function splitList(list){
var both = [ [],[] ]
var arr;
var left = []
var right = []
var middle = Math.ceil(list.length / 2)
for (var i = 0; i < middle; i++) {
both[0].push(list[i]);
}
for (var j = middle; j < list.length; j++) {
@Peege151
Peege151 / objects_defineProperties
Created March 3, 2015 20:34
Object.defineProperties
var Mammal = function(name) {
Object.defineProperties(this, {
"name": {
value: name
},
"offspring": {
value: []
}
});
}