Skip to content

Instantly share code, notes, and snippets.

@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 / iframe.html
Last active October 12, 2015 18:40
Iframe event test
<html>
<body>
<h1>This is an iframe</h1>
<script>
console.log("Iframe loaded")l;
window.addEventListener('resize', function() {
console.log('resize');
});
</script>
</body>
@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
@ghing
ghing / HandlebarsTemplateView.js
Created April 11, 2013 14:12
Backbone base view that handles compiling and retrieving templates.
define([
"underscore",
"backbone",
"handlebars"
],
function(_, Backbone, Handlebars) {
var HandlebarsTemplateView = Backbone.View.extend({
templates: {},
initialize: function(options) {
#!/usr/bin/python
## The equivalent of:
## "Working with the Skeleton"
## in the OpenNI user guide.
"""
This shows how to identify when a new user is detected, look for a pose for
that user, calibrate the users when they are in the pose, and track them.
Specifically, it prints out the location of the users' head,