Skip to content

Instantly share code, notes, and snippets.

View tokumine's full-sized avatar

tokumine

  • London, UK
View GitHub Profile
@tokumine
tokumine / postgis.rb
Created September 18, 2011 22:12
PostGIS 2.0 SVN Homebrew formula
# PostGIS 2.0SVN Homebrew Formula
#
# To use, place this file in /usr/local/Library/Formula/, then:
#
# > brew install gdal --HEAD --with-postgres
# > brew install postgis --HEAD --with-raster
#
# If you want the original formula back just go to /usr/local and do:
#
# > git checkout Library/Formula/postgis.rb
@tokumine
tokumine / load2.patch
Created June 21, 2011 13:55 — forked from taf2/load2.patch
Apply patch directly to ruby source via. patch -p0 < load.patch
--- load.c 2010-10-23 05:36:38.000000000 -0400
+++ patchload.c 2011-06-05 08:58:00.000000000 -0400
@@ -40,14 +40,6 @@
VALUE ary;
long i;
- for (i = 0; i < RARRAY_LEN(load_path); ++i) {
- VALUE str = rb_check_string_type(RARRAY_PTR(load_path)[i]);
- if (NIL_P(str) || !rb_is_absolute_path(RSTRING_PTR(str)))
- goto relative_path_found;
@tokumine
tokumine / redis_pool.js
Created June 12, 2011 15:38
A pool implementation for redis in node.js. 1 pool per redis database.
var redis = require('redis')
, Pool = require('generic-pool').Pool;
var RedisPool = {
// Acquire resource.
//
// - `database` {String} redis database name
// - `callback` {Function} callback to call once acquired. Takes the form
// `callback(err, resource)`
acquire: function(database, callback) {
@tokumine
tokumine / carto style bug
Created April 14, 2011 16:45
carto fails on numeric multiplication in styles
working carto
---------------
#land {
polygon-fill:#0A202A;
line-width:1.2;
}
non-working carto
@tokumine
tokumine / node.js v8 roadmap chats
Created April 4, 2011 19:21
Some thoughts from Ryan on node.js tracking future v8 releases
[20:09] felixge: ryah_: is there any reason node is not on v8 3.2.x yet?
[20:11] ryah_: felixge: v0.4 is sticking with the 3.1 branch
[20:11] felixge: is that just to be cautious ?
[20:12] ryah_: felixge: just want to stay stable
[20:12] ryah_: we're going to start pegging node to v8 releases
[20:12] felixge: ryah_: ok. To put my own v8 into node.js, do I just copy it in there? Or do I need some patch?
[20:12] ryah_: and consequently chrome releases
[20:13] ryah_: v8 3.1 = chrome 11 = node 0.4
[20:13] ryah_: v8 3.2 = chrome 12 = node 0.6
[20:13] ryah_: you can just copy it in
@tokumine
tokumine / vodaphone_3g.rb
Created January 16, 2011 00:25
Vodaphone 3G tile scraper configured for UK coordinates
require 'rubygems'
require 'open-uri'
require 'fileutils'
require 'rio'
xmin = 102728.5
xmax = 458539.5
ymin = 20753.4117647059
ymax = 219318
@tokumine
tokumine / .vimrc
Created December 23, 2010 00:11
add this to ~/.vimrc
set softtabstop=2
set shiftwidth=2
set tabstop=2
@tokumine
tokumine / Comparing the payload sizes of various GIS data transport types
Created September 19, 2010 19:19
Comparing the payload sizes of various GIS data transport types
# Test the size of serialized geometries, GZipped or not.
require 'msgpack'
require 'rio'
require 'fastercsv'
require 'orderedhash'
res = []
Country.all(:include => :land_geom).each do |c|
begin
# SIMPLE EXAMPLE OF USING PROTECTEDPLANET.NET API TO CHECK PROTECTION STATUS
# OF SPECIES LAT/LONG POINTS
# S.TOKUMINE & C.MILLS 2010
#
# Language: Ruby
class MainController < ApplicationController
def index
base_url = "www.protectedplanet.net"
#
# Shuffle locale YML files into 1 aggregate locale file
# if anything bad happens, back out and revert to last created yml
#
# Change en.yml to your base locale
#
namespace :i18n do
desc "Build en.yml file from separated translation files"
task :rebuild do
locale_files = Dir[File.join(RAILS_ROOT, 'config', 'locales', 'views', '**', '*.{rb,yml}')]