Skip to content

Instantly share code, notes, and snippets.

View mmcfarland's full-sized avatar

Matt McFarland mmcfarland

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>D3 Test</title>
<script src="http://d3js.org/d3.v3.min.js"></script>
</head>
<body>
<script type="text/javascript">
var dataset = [5,10,15,20,25];
def jsonp(f):
"""Wrap a json response in a callback, and set the mimetype (Content-Type) header accordingly
(will wrap in text/javascript if there is a callback). If the "callback" or "jsonp" paramters
are provided, will wrap the json output in callback({thejson})
Usage:
@jsonp
def my_json_view(request):
d = { 'key': 'value' }
@mmcfarland
mmcfarland / go_lang_tour_45
Created March 13, 2013 02:13
Go Lang Tour #35
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
outter := make([][]uint8, dy)
for i:=0; i < dy; i++ {
inner := make([]uint8, dx)
for f:=0; f<dx; f++ {
@mmcfarland
mmcfarland / philly_address+list
Last active December 15, 2015 20:09
dor parcel shp2pgsql -> autocomplete searchable
alter table dor_parcels add column full_address varchar(500);
update dor_parcels set full_address = coalesce(house, 0) || ' ' || coalesce(stdir, '') || ' ' || coalesce(stnam, '') || ' ' || coalesce(stdes, '');
create index parcel_addr_idx on dor_parcels (full_address);
alter table dor_parcels add column ts_f_address tsvector;
update dor_parcels set ts_f_address = to_tsvector('english', coalesce(full_address,''));
create index textsearch_address on dor_parcels using gin(ts_f_address);
@mmcfarland
mmcfarland / .vimrc
Last active November 21, 2017 15:24
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" " required!
Bundle 'gmarik/vundle'
Bundle 'kien/ctrlp.vim'
Bundle 'tpope/vim-vinegar'
Bundle 'tpope/vim-surround'
Bundle 'tpope/vim-repeat'
@mmcfarland
mmcfarland / philatour_load
Created July 4, 2013 13:28
Load historical places
unzip PhiladelphiaHistoricSites_PhilaReg201201.zip
sudo -u postgres createdb philatour
sudo -u postgres shp2pgsql -I -s 2272 PhiladelphiaHistoricSites_PhilaReg201201.shp public.sites | sudo -u postgres psql -d philatour
@mmcfarland
mmcfarland / bhna.geojson
Created July 31, 2013 17:11 — forked from anonymous/map.geojson
Boundary for Baynton Hill Neighbors Association
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mmcfarland
mmcfarland / gist:8290075
Created January 6, 2014 21:25
Ideas for .NET extension methods
  • Enum Get Name list
@mmcfarland
mmcfarland / dups.sh
Last active August 29, 2015 14:05
Checks for duplicate values for a column in an Excel file. Requires libreoffice.
# usage:
# arg1: xls file
# arg2: col position to check for dups
#
# file name without extension
base_name=$(echo $1 | cut -d. -f1)
# convert to csv
libreoffice --headless --convert-to csv $1 --outdir .
{
"features": [
{
"geometry": {
"coordinates": [
[
[
-75.27592602596428,
39.89805555562
],