Skip to content

Instantly share code, notes, and snippets.

View RandomEtc's full-sized avatar
🦕

Tom Carden RandomEtc

🦕
View GitHub Profile
@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 / 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 / README.mkd
Created September 28, 2010 00:11
smooth panning and zooming for polymaps
@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
<!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/
*
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);
}
@RandomEtc
RandomEtc / BingMapsProvider.as
Created August 11, 2010 00:14
experimental Modest Maps provider for the Bing REST API
package com.modestmaps.mapproviders.microsoft
{
import com.modestmaps.core.Coordinate;
import com.modestmaps.mapproviders.AbstractMapProvider;
import com.modestmaps.mapproviders.IMapProvider;
import com.modestmaps.util.BinaryUtil;
import flash.events.Event;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;
@RandomEtc
RandomEtc / ComposedEventDispatcher.as
Created August 10, 2010 18:31
implements IEventDispatcher, for when you can't subclass EventDispatcher directly
///// IN IMPORTS
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
/////
///// IN CLASS DECLARATION:
implements IEventDispatcher
/////
///// IN CONSTRUCTOR:
@RandomEtc
RandomEtc / yql-csv.html
Created July 27, 2010 06:12
load csv files from anywhere using YQL
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
url: 'http://query.yahooapis.com/v1/public/yql',
data: {
q: "select * from csv where url='http://www.tom-carden.co.uk/p5/tube_map_travel_times/data/lines2.csv' and columns='station1,station2,line,time'",
format: 'json'
@RandomEtc
RandomEtc / albers.js
Created July 14, 2010 23:18
An Albers Equal Area Conic projection in javascript, for protovis.
/*
An Albers Equal Area Conic projection in javascript, for protovis.
For centering the contiguous states of the USA in a 800x400 div, I used:
var scale = pv.Geo.scale(albers(23, -96, 29.5, 45.5))
.range({ x: -365, y: -375 }, { x: 1200, y: 1200 });
http://mathworld.wolfram.com/AlbersEqual-AreaConicProjection.html