Skip to content

Instantly share code, notes, and snippets.

@ghing
ghing / areas.txt
Created July 8, 2011 19:32
Output of psql -U publicmapping publicmapping_ohio_v1_2 -c "select round(st_area(geom)) as g_area, round(st_area(simple)) as s_area from redistricting_geounit where geolevel_id > 1;" > areas
g_area | s_area
------------+------------
188777863 | 188821726
1772952 | 1773885
115330738 | 115299478
123402715 | 123389629
168916950 | 169004177
16810917 | 16829315
75493624 | 75438669
2788115 | 2780298
@ghing
ghing / postgresql-8.4-main-excerpt.log
Created July 8, 2011 20:07
Postgres logs behind 500 error
2011-07-08 15:03:00 CDT ERROR: GEOS Intersection() threw an error!
2011-07-08 15:03:00 CDT STATEMENT: SELECT rd.id,
rd.district_id,
rd.name,
rd.is_locked,
lmt.version,
rd.plan_id,
rc.subject_id,
rc.number,
st_asgeojson(
@ghing
ghing / celeryd-ohio-excerpt.log
Created July 8, 2011 21:01
Error when trying to import my State Senate District 16-only district index file.
[2011-07-08 16:54:00,264: ERROR/MainProcess] Task redistricting.utils.index2plan[053e21e9-7bad-4693-b96a-73e
88872da5d] raised exception: GEOSException('Error encountered checking Geometry returned from GEOS C functio
n "GEOSDifference_r".',)
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/celery-2.1.4-py2.6.egg/celery/execute/trace.py", line 34, in
trace
return cls(states.SUCCESS, retval=fun(*args, **kwargs))
File "/usr/local/lib/python2.6/dist-packages/celery-2.1.4-py2.6.egg/celery/task/base.py", line 248, in __c
all__
return self.run(*args, **kwargs)
@ghing
ghing / ohcalculators.py
Created August 10, 2011 16:20
Custom calculators for Ohio District Builder instance
import sys
from django.conf import settings
from publicmapping.redistricting.calculators import CalculatorBase, SplitCounter, Roeck
from decimal import Decimal
class ValueRange(CalculatorBase):
"""
Determine a value, and indicate if it falls within a range
@ghing
ghing / jquery.bigbg.js
Created January 20, 2012 22:59
Skeleton for a jQuery plugin to offer various operations to make large background images work out.
/**
* A jQuery plugin to resize the front page image to match the window.
*/
(function( $ ){
var methods = {
init: function () {
},
setFrontPageImageDimensions: function () {
@ghing
ghing / jquery-keepup.js
Created January 24, 2012 21:46
Skeleton for a jQuery plugin to get elements matching heights
/**
* jQuery Plugin: "keepup"
* by: Geoffrey Hing <geoffhing@gmail.com>
*
* Copyright (c) 2012 Geoffrey Hing
* Licensed under MIT (http://www.opensource.org/licenses/mit-license.php)
*
* Description: Sets the height of one element equal to another.
* Dependencies: jQuery library.
* Usage Example: $('.element-to-resize').keepUp('matchHeight', $('.element-to-match'));
@ghing
ghing / index.html
Last active October 3, 2015 18:38
Drawing a spider web with d3
<html>
<head>
<title>Webmaking</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="http://d3js.org/d3.v2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
function getPoints(radius, segments, levels) {
points = {
@ghing
ghing / dabblet.css
Created January 13, 2013 16:48 — forked from anonymous/dabblet.css
Issue #449 Link Color Examples
/**
* Issue #449 Link Color Examples
*/
body { width: 100%; }
.swatches {
position: relative;
width: 100%;
overflow: hidden;
}
@ghing
ghing / api_guide.md
Last active December 15, 2015 01:09
API Guide wiki page for SC3 inmate tracker