Skip to content

Instantly share code, notes, and snippets.

@mjumbewu
mjumbewu / index.html
Created January 21, 2011 18:21
An SVG-based map of the United States of America
<!--
Thanks to:
@atogle, @evansml, @maxogden, @chachasikes, @peterfecteau, @mjumbewu
-->
<!doctype html>
<html>
<head>
@mjumbewu
mjumbewu / intersection.json
Created October 8, 2011 15:56
intersection of the 12 and the 21
{ "type": "MultiLineString", "coordinates": [ [ [ 2689354.393741, 235542.226547 ], [ 2689680
.056343, 235500.585944 ] ], [ [ 2689680.056343, 235500.585944 ], [ 2689906.467823, 235472.771
528 ] ], [ [ 2689906.467823, 235472.771528 ], [ 2690126.450528, 235442.482106 ] ], [ [ 269012
6.450528, 235442.482106 ], [ 2690668.307707, 235371.693559 ] ], [ [ 2690668.307707, 235371.69
3559 ], [ 2690967.117328, 235331.751372 ] ], [ [ 2690967.117328, 235331.751372 ], [ 2691110.1
55178, 235313.934206 ] ], [ [ 2691110.155178, 235313.934206 ], [ 2691553.989137, 235251.74816
8 ] ], [ [ 2691553.989137, 235251.748168 ], [ 2691994.852367, 235195.886479 ] ], [ [ 2691994.
852367, 235195.886479 ], [ 2692441.118122, 235136.569144 ] ], [ [ 2692441.118122, 235136.5691
44 ], [ 2692455.314000, 235134.904336 ] ], [ [ 2692455.314000, 235134.904336 ], [ 2692662.259
111, 235110.639190 ] ], [ [ 2692662.259111, 235110.639190 ], [ 2692885.033700, 235079.974076
@mjumbewu
mjumbewu / mapping_notes.py
Created October 8, 2011 16:52
mapping notes
# run 'python manage.py shell'...
from django.contrib.gis.geos import Point
from septa.models import SeptaStops, SeptaRoutes
ONE_MILE = 0.015
# This is around Devnuts HQ
my_location = Point(-75.142257, 39.965165)
nearby = my_location.buffer(ONE_MILE / 2)
@mjumbewu
mjumbewu / tropo1.py
Created November 2, 2011 01:09
My first tropo script
#!/usr/bin/python
say('hello')
@mjumbewu
mjumbewu / index.html
Created January 25, 2012 21:59
Isometric Z-Scrolling
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<style>
body {
background-color: SkyBlue;
margin: 0px;
padding: 0px;
}
<div class="node-add-wrapper clear-block">
<div class="node-column-sidebar">
<?php if($sidebar): ?>
<?php print render($sidebar); ?>
<?php endif; ?>
</div>
<div class="node-column-main">
<?php if($form): ?>
<?php print drupal_render_children($form); ?>
<?php endif; ?>
@mjumbewu
mjumbewu / gist:3614854
Created September 3, 2012 23:35
Synaptics TouchPad properties on a System76 Lemur
mjumbewu@lemur:~$ uname -a
Linux lemur 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27 17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
mjumbewu@lemur:~$ xinput list-props 12
Device 'SynPS/2 Synaptics TouchPad':
Device Enabled (132): 1
Coordinate Transformation Matrix (134): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (254): 1
Device Accel Constant Deceleration (255): 2.500000
Device Accel Adaptive Deceleration (256): 1.000000
Device Accel Velocity Scaling (257): 12.500000
@mjumbewu
mjumbewu / gist:3651921
Created September 6, 2012 06:05
An example of how to do URL resolution with django-jstemplates
# chadmasso has an interesting solution to using Django template tags in your
# Handlebars JS templates: precompile the template to Handlebars JS code, and
# then run the template through Django's template renderer.
#
# https://github.com/chadmasso/pencilthin
#
# Below are two possibilities for how a similar thing would be accomplished in
# django-jstemplate.
#
# 1) PREPROCESSOR(S)
@mjumbewu
mjumbewu / gist:3677442
Created September 8, 2012 17:20 — forked from ptone/gist:3490967
Using djangorestframework2 to get JSON given just a resource outside of a view
from djangorestframework.renderers import JSONRenderer
from colorpicks.serializer import ColorSerializer
# NOTE: Resources are nominally much less present in the
# restframework2 branch. You use Serializers directly
# to achieve the same thing.
obj = ...
serializer = ColorSerializer(instance=obj)
data = serializer.data
#!/usr/bin/env python
import os
from django.core.management import setup_environ
import settings
setup_environ(settings)
from django.conf import settings
from django.contrib.gis.gdal import CoordTransform, DataSource, OGRGeometry, OGRGeomType
from django.core.management.base import BaseCommand