Skip to content

Instantly share code, notes, and snippets.

@robban
robban / poly_clockwise.py
Last active December 22, 2022 15:35 — forked from ChrisBarker-NOAA/poly_clockwise.py
clockwise tests for polygons
#!/usr/bin/env python
"""
code for checking if a polygon is cockwise or counter-clockwise
There are two versions:
is_clockwise_convex only works for convex polygons -- but is faster,
it only needs to check three points.
@robban
robban / convert_images_to_paperclip.rb
Created March 11, 2012 15:29
Migrate communityengine photos from attachment_fu to paperclip
class ConvertImagesToPaperclip
def self.convert_all
# Update table information
Photo.reset_column_information
# Delete all attachement_fu image sizes
Photo.delete_all("parent_id IS NOT NULL")
@robban
robban / gist:328191
Created March 10, 2010 18:44
Easily add a google map location picker to your form
<!--
Use this snippet to add a google map location chooser to your form
Step 1: Get a google map api key and insert it in the first javascript tag
Step 2: In your html form, create two hidden elements, one for latitude, and one for longitude. Give the elements ids and set the LATITUDE_ELEMENT_ID and LONGITUDE_ELEMENT_ID to the appropriate variables
Done!
-->