Skip to content

Instantly share code, notes, and snippets.

@mojodna
mojodna / gist:5609010
Created May 19, 2013 21:05
Importing Natural Earth into PostGIS w/ ogr2ogr
P900913="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"
EXTENT="-180 -85.05112878 180 85.05112878"
ogr2ogr --config PG_USE_COPY YES --config OGR_ENABLE_PARTIAL_REPROJECTION TRUE --config SHAPE_ENCODING WINDOWS-1252 -t_srs "$P900913" -lco ENCODING=UTF-8 -lco SRID=900913 -clipsrc $EXTENT -segmentize 1 -skipfailures -f PGDump /vsistdout/ ne_10m_populated_places.shp | pv | psql -d natural_earth -q
@kehh
kehh / st_split.sql
Last active December 17, 2015 10:39
Wrapping polygons so they don't sit on the date line Requires st_split http://postgis.17.x6.nabble.com/ST-Split-in-1-5-tp4999369p4999388.html st_split for postgis 1.5 st_wrapx from: https://github.com/mci/mpatlas/blob/master/mpatlas/ST_WrapX.sql
CREATE OR REPLACE FUNCTION st_split(polygon geometry,split_line geometry) RETURNS SETOF geometry AS
$$
DECLARE
v_geometry geometry;
BEGIN
FOR v_geometry IN SELECT (ST_Dump((
ST_Polygonize(ST_Union(ST_Boundary(polygon),split_line))
@shawnbot
shawnbot / index.md
Last active August 23, 2023 10:18
Testing web pages with Xcode's iOS Simulator

Finding the Simulator

You can test with the iOS Simulator that comes with Xcode. Navigate to the Xcode app in the Finder, right click and select "Show Package Contents":

screen shot 2013-05-06 at 12 04 27 pm

Then navigate to Contents > Applications, and open the shortcut to "iPhone Simulator" (it may be called "iOS Simulator" depending on which version of Xcode you're running):

screen shot 2013-05-06 at 12 05 45 pm

al@zorak.tobert.org ~ $ sudo virsh dumpxml newsblur
<domain type='lxc'>
<name>newsblur</name>
<uuid>cf64daa0-9fd0-088f-2bf2-436f23c43e88</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64'>exe</type>
<init>/sbin/init</init>

So yesterday brought the sad news that Google Reader is being killed off. C’est la vie it seems, given it was a Google product. In my search for an alternative I rediscovered Fever and decided to see if I could run it up for free on Heroku. Onwards...

Personally I think the news about Reeder is quite sad, as I would quite happily have paid for it as a service. In fact I like RSS so much that I actually shelled out the $30 for Fever when it first came out years ago (I was also pretty massive Shaun Inman fanboy if I’m being honest).

I ended up setting Fever aside because screw having to manage self-hosting for PHP and MySQL, right?

If you’re new to Fever I recommend going and checking it out, but also reading the post in response to the Google Reader announcement by Fevers author, Shaun, for a good list of what Fever is and isn’t.

Enough jibba-jabba!

@shawnbot
shawnbot / leaflet-compact.js
Created March 13, 2013 18:04
A Leaflet TileLayer class for loading "compact" URL schemes.
L.CompactTileLayer = L.TileLayer.extend({
getTileUrl: function(tilePoint) {
this._adjustTilePoint(tilePoint);
var col = String("000000" + tilePoint.x).slice(String(tilePoint.x).length),
row = String("000000" + tilePoint.y).slice(String(tilePoint.y).length),
zoom = this._getZoomForUrl();
return this._url
.replace("{z}", zoom)
.replace("{x}", col.slice(0, 3) + "/" + col.slice(3, 6))
.replace("{y}", row.slice(0, 3) + "/" + row.slice(3, 6));
@OllyHodgson
OllyHodgson / sparkline.svg
Created January 7, 2013 09:50
Stuart Langridge's Simple SVG sparklines — http://kryogenix.org/days/2012/12/30/simple-svg-sparklines — but using an object element instead of an embed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bmander
bmander / dotmap.pde
Created December 27, 2012 04:26
Generate dotmap tiles
/* I, Brandon Martin-Anderson, release this into the public domain or whatever. */
BufferedReader reader;
double ll, bb, rr, tt;
float A = 1000.0;
GlobalMercator proj = new GlobalMercator();
@migurski
migurski / RemoteGeoJSON.py
Created December 14, 2012 06:03
Sample datasource for remote tiled data in Mapnik.
''' Sample datasource for remote tiled data in Mapnik.
See also https://github.com/mapnik/mapnik/wiki/Python-Plugin
Use in Mapnik:
<Datasource>
<Parameter name="type">python</Parameter>
<Parameter name="factory">RemoteGeoJSON:Datasource</Parameter>
@springmeyer
springmeyer / dot-density-points.diff
Created December 6, 2012 04:42
Messing around with using halton sequences for quasi-random point filling of polygons (applied to mapnik @ ff8f3f1d4597eed89e04aa1dc7cb4755f6d4a744)
diff --git a/src/agg/process_point_symbolizer.cpp b/src/agg/process_point_symbolizer.cpp
index 6854903..abf1972 100644
--- a/src/agg/process_point_symbolizer.cpp
+++ b/src/agg/process_point_symbolizer.cpp
@@ -40,8 +40,58 @@
// boost
#include <boost/make_shared.hpp>
+#include <boost/utility.hpp>
+