Skip to content

Instantly share code, notes, and snippets.

View hampelm's full-sized avatar

Matt Hampel hampelm

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<Map srs="+proj=latlong +ellps=WGS84 +datum=WGS84 +no_defs">
<Stylesheet src="style.mss"/>
<Layer class="road secondary" srs="+proj=latlong +ellps=WGS84 +datum=WGS84 +no_defs">
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">/Users/matth/Projects/D-ACIS/area/geo/raw/michigan.shapefiles/michigan_highway.shp</Parameter>
</Datasource>
</Layer>
<requestHandler name="dismax" class="solr.SearchHandler" >
<lst name="defaults">
<str name="defType">dismax</str>
<str name="echoParams">explicit</str>
<float name="tie">0.01</float>
<str name="qf">
text features name description id
</str>
<str name="fl">
id,name,price,score,description
import os
path="/some/directory"
dirList=os.listdir(path)
for fname in dirList:
print fname
@hampelm
hampelm / umod_scraper.py
Created November 19, 2010 21:29
A small script for getting information in bulk out of the U-M Directory
'''
Matt Hampel <hampelm@umich.edu>
A small script for getting information in bulk out of the U-M Directory.
Requires: python-ldap (easy_install python-ldap)
Use: python scripy.py infile.csv outfile.csv
Where infile.csv is a text file with one name per line.
@hampelm
hampelm / gist:1057176
Created June 30, 2011 20:38
CiviCRM Stale Contacts Query
SELECT *
FROM civicrm_contact
WHERE id NOT
IN ( 1 )
SELECT *
FROM civicrm_log
WHERE entity_table='civicrm_contact'
LEFT_JOIN civicrm_contact ON civicrm_log.entity_id=civicrm_contact.id
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<Metadata>
<xsl:for-each select="records/doc">
<elt>
<xsl:for-each select="*">
.car {
width:100px;
height:100em; //or whatever
float:left;
position:relative;
}
.appointment {
background:#eee;
position:absolute;
import stat
def is_world_readable(path):
return os.stat(path).st_mode & stat.S_IROTH
tempdir = tempfile.gettempdir()
if not is_world_readable(tempdir):
if not is_world_readable('/tmp'):
print "ERROR: Can't create temporary file."
exit()
@hampelm
hampelm / gist:2288206
Created April 3, 2012 00:18
TileMill Export Process Sample
Sampling process 698 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling node (pid 698) every 1 millisecond
Process: node [698]
Path: /Applications/TileMill.app/Contents/Resources/node
Load Address: 0x10f3eb000
Identifier: node
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: node [364]
@hampelm
hampelm / gist:2355659
Created April 10, 2012 23:40
Proposed response structure
// I feel like the responses datatype should be simplified from its current form, pasted here:
var data = {
responses: [
{ parcels: [ {parcel_id: '10', responses: {'Q0': 0, 'Q1': 3}} ] },
{ parcels: [ {parcel_id: '11', responses: {'Q0': 1, 'Q1': 4}} ] }
]
};
// To one without the additional {parcels: } object, which doesn't seem to add much: