Skip to content

Instantly share code, notes, and snippets.

View djq's full-sized avatar

David Quinn djq

  • Google
  • Dublin
View GitHub Profile

Introduction to the CartoDB interface

This page can always be found at: http://bit.ly/cdb-harvard

  • Tour of dashboard
  • Common data
  • Uploading data
  • Tour of table and map view
  • Publishing maps
  • Public profile
@michaelgwelch
michaelgwelch / link_story2.user.js
Created March 24, 2012 16:13
A greasemonkey script that creates a link from commit to story on pivotal tracker
@Guerino1
Guerino1 / index.html
Created April 3, 2012 20:24
Simple D3 Pie Chart with Magnitudes in Arcs and Legends Outside and Along Arcs
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.4.5"></script>
<!-- Source for example located at: http://bl.ocks.org/1203641 -->
@cspanring
cspanring / ubuntu-django-setup.md
Created September 12, 2012 12:26
A few quick steps to setup Ubuntu 10.04 as Django application server

Basic Ubuntu 10.04.3 LTS server setup to deploy Django appplications

This document covers basic steps to setup

  • a django user who will serve Django applications,
  • [Nginx] as web server,
  • [Gunicorn] as a WSGI and
  • [PostgreSQL] with [PostGIS] as database server.

...on a default Ubuntu 10.04 server installation.

Stop number Name without locality Locality Locality number Code Name NaPTAN stop class NaPTANId Easting Northing
1 Pearse Street (Pearse Avenue) Sallynoggin E0825024 ->NE2 Stop No. 3234 BCT 8250DB003234 724091 726427
1 Pearse Street (Pearse Avenue) Sallynoggin E0825024 ->SW1 Stop No. 3210 BCT 8250DB003210 724087 726412
2 Lr. Drumcondra Road Drumcondra (Dublin) E0822021 1 Drumcondra Road Lower BCT 825000101 715947 736197
2 Lr. Drumcondra Road Drumcondra (Dublin) E0822021 2 Drumcondra Road Lower BCT 8250B1001201 715929 736199
3 Clontarf Road Junction Strandville Avenu Clontarf E0822038 1 Stop No. 1741 BCT 8220DB001741 718428 736222
4 College Green Dublin City South E0822091 1 Taxi Rank TXR 8220TR000078 715797 734107
4 College Green Dublin City South E0822091 2 Stop No. 1359 BCT 8220DB001359 715770 734095
4 College Green Dublin City South E0822091 3 College Green BCT 825000157 715769 734095
4 College Green Dublin City South E0822091 4 Stop No. 4522 BCT 8220DB004522 715821 734081
@djq
djq / gist:58558ac644a6c15f52ac
Last active November 2, 2015 16:06
Intro to spatial data using django
# ----
# Background
# ----
#
# Vectors:
# vectors consist of points, lines, polygons
# Within GeoDjango, data-types which are multipolygon and geometry also exist
#
# Projections:
# Projection systems facilitate translating data between a 3D and 2D space.
from oauth2 import Token
from social_auth.backends.utils import build_consumer_oauth_request
from social_auth.backends.facebook import FacebookAuth
def facebook_profile_image(user):
try:
social_auth = user.social_auth.filter(provider='facebook')[0]
except IndexError:
return []
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@johnpolacek
johnpolacek / lazyloadimages.js
Last active December 17, 2015 14:59
Lazy Load Images
// <a href="product.html" data-lazy-image="product.jpg" data-lazy-image-alt="The Product"></a>
;(function($) {
$('*[data-lazy-image]').each(function() {
var alt = $(this).attr('data-lazy-image-alt') === undefined ? '' : 'alt="'+$(this).attr('data-lazy-image-alt')+'"';
$(this).append($('<img src="'+$(this).attr('data-lazy-image')+'" '+alt+'" />'));
});
}(jQuery));
import re
from django.conf import settings
from django.core import cache as django_cache
from mock import patch
from rest_framework.permissions import SAFE_METHODS
from rest_framework.response import Response
class CachedResourceMixin (object):
@property