Skip to content

Instantly share code, notes, and snippets.

View ajturner's full-sized avatar
🗺️
Considering WhereCamps

Andrew Turner ajturner

🗺️
Considering WhereCamps
View GitHub Profile
@bigeasy
bigeasy / .bash_profile
Created June 27, 2012 17:44
hidegrep
# Add to your `.bash_profile`. If you do something that is incredibly
# destructive, like `git push --force origin HEAD`, you can then
# delete it, how ever many times you've run it, from your history
# using `hidegrep --force`.
function hidegrep()
{
while true; do
hist=$(history | grep -e "$1" | head -n 1)
if [ -z "$hist" ]; then break; fi
@sgillies
sgillies / geo_interface.rst
Last active May 7, 2025 20:01
A Python Protocol for Geospatial Data

Author: Sean Gillies Version: 1.0

Abstract

This document describes a GeoJSON-like protocol for geo-spatial (GIS) vector data.

Introduction

@tecoholic
tecoholic / osm2geo.js
Created November 27, 2011 04:57
OSM2GEO - A JS Converter to convert OSM to GeoJSON
/**************************************************************************
* OSM2GEO - OSM to GeoJSON converter
* OSM to GeoJSON converter takes in a .osm XML file as input and produces
* corresponding GeoJSON object.
*
* AUTHOR: P.Arunmozhi <[email protected]>
* DATE : 26 / Nov / 2011
* LICENSE : WTFPL - Do What The Fuck You Want To Public License
* LICENSE URL: http://sam.zoy.org/wtfpl/
*
@pjb3
pjb3 / open_method_def_in_textmate.rb
Created March 9, 2011 22:54
You can find at runtime where a method was defined. This is a little hack to then open that method in textmate
> m = 2.days.method(:ago)
=> #<Method: Fixnum(ActiveSupport::CoreExtensions::Numeric::Time)#ago>
> m.__file__
=> "/Users/paul/.rvm/gems/ree-1.8.7-2011.03@deals/gems/activesupport-2.3.5/lib/active_support/core_ext/numeric/time.rb"
> m.__line__
=> 64
> class Method; def open_in_textmate; `mate -l #{__line__} #{__file__}`; end; end
=> nil
> 2.days.method(:ago).open_in_textmate
=> ""
@codepo8
codepo8 / localstorage.js
Created August 25, 2010 14:44
Store the state of a rendered form the easy way
<script>
// test for localStorage support
if(('localStorage' in window) && window['localStorage'] !== null){
var f = document.getElementById('mainform');
// test with PHP if the form was sent (the submit button has the name "sent")
<?php if(isset($_POST['sent']))){?>
// get the HTML of the form and cache it in the property "state"
localStorage.setItem('state',f.innerHTML);