Skip to content

Instantly share code, notes, and snippets.

💭
merging your prs

Tom MacWright tmcw

💭
merging your prs
Block or report user

Report or block tmcw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:158843
var kml_layers = new Array();
/**
* Process KML Layers
*
* @param layerOptions
* Object of options
* @param mapid
* Map ID
* @return
View gist:181017
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Renderer/Elements.js
*/
/**
* Class: OpenLayers.Renderer.VML
View gist:181018
/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
* license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Renderer/Elements.js
*/
/**
* Class: OpenLayers.Renderer.VML
View gist:200104
#!/usr/bin/env ruby
# coding: utf-8
require 'rubygems'
require 'fastercsv'
require 'pdf/reader'
require 'CSV'
class Array
def to_csv
str=''
View gist:201656
# python code for soft-hyphenation of CamelCase text
hyphenated = re.sub('([a-z])([A-Z])', r'\1­\2', text)
View Python Multiprocessing S3 Uploads
#!/usr/bin/env python
from multiprocessing import Pool
import os
# 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.
View strip_00_from_kml.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
file = ARGV[0]
nok = Nokogiri::XML(open(file))
nok.css('Placemark').each do |p|
if p.css('Point coordinates').inner_text == '0.0,0.0'
View extra-contact-addresses.rb
require 'rubygems'
require 'sqlite3'
# So this is address and name-completion for the sup mail client, which is
# really quite nice in a sort of vim-ish way
# However, I've switched since writing this, mainly because sup doesn't play nice with any other
# mail clients, so it screws up my read/unread/labeled systems when I'm using my iPhone, etc.
# Supposedly this is an upcoming feature, but it has been for a while and seems non-essential
# to the developers.
View gist:273033
/**
* Google Maps API 2.0
* MapBox integration.
*
* Do not remove the MapBox or OpenStreetMap attribution from this code,
* doing so is in violation of the terms of both licenses.
*/
/**
* Factory function for a MapBox layer for use with a
View gist:277631
def report_feed(request):
reports = FieldReport.objects.kml()
r = render_to_kml('kml/placemarks.kml', {'places' : reports})
r['Content-Disposition'] = 'attachment;filename=reports.kml'
return r
You can’t perform that action at this time.