Skip to content

Instantly share code, notes, and snippets.

View RandomEtc's full-sized avatar
🦕

Tom Carden RandomEtc

🦕
View GitHub Profile
function loadCSV(url, columns, callback) {
var req = new XMLHttpRequest();
req.open('GET', url, true);
req.onreadystatechange = function (aEvt) {
if (req.readyState == 4) {// && req.status == 200) {
callback(parseCSV(req.responseText, columns));
}
};
req.send(null);
}
<!DOCTYPE html>
<html>
<head>
<title>Modest Maps JS</title>
<script type="text/javascript">
/*!
* Modest Maps JS v0.13.2X (fork for gist)
* http://modestmaps.com/
*
@RandomEtc
RandomEtc / README
Created September 27, 2010 20:09
Modest Maps JS - Smooth Efficient Zooming and Panning
http://www.win.tue.nl/~vanwijk/zoompan.pdf for Modest Maps JS
@RandomEtc
RandomEtc / README.mkd
Created September 28, 2010 00:11
smooth panning and zooming for polymaps
@RandomEtc
RandomEtc / tile.js
Created November 9, 2010 01:25
shape rendering in nodejs with LearnBoost's node-canvas
// node.js geo polygon map tile rendering!
// requires https://github.com/learnboost/node-canvas and GeoJSON data files
// e.g.
// data from naturalearthdata.com converted to GeoJSON with GDAL's ogr2ogr
// or from datasf.org, reprojected too:
// ogr2ogr -f GeoJSON sfbay.js sfbay.shp -t_srs EPSG:4326
var Canvas = require('./vendor/node-canvas/lib/canvas'),
http = require('http'),
fs = require('fs');
@RandomEtc
RandomEtc / challenge.js
Created December 24, 2010 03:35
Node.js as an alertnative to Lisp ;-)
// Node.js as an alertnative to Lisp ;-)
// see http://norvig.com/java-lisp.html
// and http://www.flownet.com/ron/papers/lisp-java/instructions.html
// all we need from node.js is file reading
var fs = require('fs');
// mappings from characters to digits
@RandomEtc
RandomEtc / OpenStreetMapProvider.pde
Created March 5, 2011 00:18
A Modest Maps provider for OpenStreetMap in Processing
import processing.core.*;
import com.modestmaps.core.*;
import com.modestmaps.geo.*;
public class OpenStreetMapProvider extends AbstractMapProvider {
public String[] subdomains = new String[] { "", "a.", "b.", "c." };
public OpenStreetMapProvider() {
@RandomEtc
RandomEtc / TextField.h
Created August 9, 2011 23:53
UITextField wrapper for Cinder
//
// TextField.h
//
// Created by Tom Carden on 8/9/11.
// Copyright 2011 Bloom Studio, Inc. All rights reserved.
//
#pragma once
#include <string>
@RandomEtc
RandomEtc / KeyEvent.h
Created August 16, 2011 02:27
Cinder's KeyEvent.h modified to hold a std::string (UTF8) rather than a char (ASCII)
/*
Copyright (c) 2010, The Barbarian Group
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
@RandomEtc
RandomEtc / modestmaps-static.js
Created August 23, 2011 06:52
Node.js server for composing map tiles using modestmaps.js
var MM = require('modestmaps'),
Canvas = require('canvas'),
Image = Canvas.Image;
get = require('get'),
express = require('express');
function renderStaticMap(provider, dimensions, zoom, location, callback) {
var canvas = new Canvas(dimensions.x, dimensions.y),
ctx = canvas.getContext('2d');