Skip to content

Instantly share code, notes, and snippets.

View YenTheFirst's full-sized avatar

Talin YenTheFirst

  • Opendoor
  • San Francisco
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@YenTheFirst
YenTheFirst / index.html
Created March 26, 2013 19:10
incorrect reflections
<!doctype html><title>Minimal tQuery Page</title>
<script src="http://jeromeetienne.github.com/tquery/build/tquery-bundle-require.js"></script>
<script src="http://jeromeetienne.github.com/tquery/plugins/mirror/tquery.mirrorplane.js"></script>
<body><script>
requirejs.config({ baseUrl : "http://www.corsproxy.com/jeromeetienne.github.com/tquery/plugins/requirejs/examples/" })
require([ 'tquery.skymap'
, 'tquery.grassground'
, 'tquery.minecraft'
, 'tquery.objectcoord'
], function(){
@YenTheFirst
YenTheFirst / index.html
Created March 22, 2013 07:26
recursive portals
<html>
<head>
<title>spinnin' cubes! yes! plural!</title>
<style>canvas { width: 100%; height: 100% }</style>
</head>
<body>
<script src="https://raw.github.com/mrdoob/three.js/master/build/three.js"></script>
<script>
//create basic context
var main_scene = new THREE.Scene();
@YenTheFirst
YenTheFirst / index.html
Last active December 19, 2015 17:50
basic portal effect (1-way, nonrecursive)
<html>
<head>
<title>spinnin' cubes! yes! plural!</title>
<style>canvas { width: 100%; height: 100% }</style>
</head>
<body>
<script src="https://raw.github.com/mrdoob/three.js/master/build/three.js"></script>
<script>
//create basic context
var main_scene = new THREE.Scene();
@YenTheFirst
YenTheFirst / simple_test.xml
Last active December 14, 2015 02:59
simple test case for size differences between python-mapnik and node-mapnik
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
<Parameters>
<Parameter name="bounds">-180,-85.05112877980659,180,85.05112877980659</Parameter>
<Parameter name="center">0,0,2</Parameter>
<Parameter name="format">png</Parameter>
<Parameter name="minzoom">0</Parameter>
<Parameter name="maxzoom">22</Parameter>
@YenTheFirst
YenTheFirst / gist:5017929
Created February 23, 2013 01:46
rendering test image in python. less network traffic to database than node-mapnik for some reason.
import mapnik
mmap = mapnik.Map(0, 0)
mapnik.load_map(mmap, path_to_xml)
mmap.width = 256
mmap.height = 256
mmap.zoom_to_box(mapnik.Box2d(-9079495.967826376,2817774.6107047386,-8766409.899970295, 3130860.6785608195 ))
img = mapnik.Image(256, 256)
mapnik.render(mmap, img)
img.save("test_output.png")
<Layer name="<data_layer>"
srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>style1</StyleName>
<StyleName>style2</StyleName>
<StyleName>style3</StyleName>
<StyleName>style4</StyleName>
<Datasource>
<Parameter name="type"><![CDATA[postgis]]></Parameter>
<Parameter name="table"><![CDATA[thetablename]]></Parameter>
<Parameter name="key_field"><![CDATA[]]></Parameter>
@YenTheFirst
YenTheFirst / gist:5017847
Created February 23, 2013 01:21
rendering tile based on XML file with node-mapnik
options = {z:7,x:35,y:54, metatile:1, tileSize:256,format:'png'}
calculateMetatile = require('tilelive-mapnik/lib/render')['calculateMetatile']
meta = calculateMetatile({z:7,x:35,y:54, metatile:1, tileSize:256,format:'png'})
var mapnik = require('mapnik')
options.headers = { 'Content-Type': 'image/png' };
var image = new mapnik.Image(meta.width, meta.height);
var map = new mapnik.Map(256,256);
map.bufferSize=0
map.fromString(path_to_Xml, {strict: false, base: path_to_base}, function(err,map) {console.log('done')})
map.loadSync(<path_to_xml>)
@YenTheFirst
YenTheFirst / index.html
Created February 8, 2013 00:53
more cats and pointer events
<html>
<head>
<style type="text/css">
#over{
position: absolute;
left: 20;
}
</style>
<script type="text/javascript">
@YenTheFirst
YenTheFirst / index.html
Created February 6, 2013 20:24
repost of previous
<html>
<head>
<style type="text/css">
#over{
position: absolute;
left: 20;
}
</style>
<script type="text/javascript">