This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Author(models.Model): | |
first_name = models.CharField(max_length=200) | |
last_name = models.CharField(max_length=200) | |
class Book(models.Model): | |
title = models.CharField(max_length=200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mechanize import Browser | |
from BeautifulSoup import BeautifulSoup | |
def extract(html): | |
soup = BeautifulSoup(html) | |
table = soup.find("table", border=1) | |
list_of_rows = [] | |
for row in table.findAll('tr')[1:]: | |
list_of_cells = [] | |
for cell in row.findAll('td'): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
nominee_list = [ | |
"Eric Malnik", # http://articles.latimes.com/print/2010/jul/29/local/la-me-eric-malnic-20100729 | |
"Charles Hillenger", # http://articles.latimes.com/print/2008/apr/30/local/me-hillinger30 | |
"Jim Murray", # http://articles.latimes.com/print/1998/aug/18/news/mn-14252 | |
"George Ramos", # http://articles.latimes.com/print/2011/jul/25/local/la-me-george-ramos-20110725 | |
"Frank del Olmo", # http://www.latimes.com/local/obituaries/la-me-delolmo20feb20-story.html#page=1 | |
"Laurie Becklund", # http://www.latimes.com/opinion/op-ed/la-oe-becklund-breast-cancer-komen-20150222-story.html#page=1 | |
"Bill Billiter", # http://articles.latimes.com/print/1997-04-20/local/me-50644_1_orange-county |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
httpd 21621 root cwd DIR 0,179 4096 169321800 / | |
httpd 21621 root rtd DIR 0,179 4096 169321800 / | |
httpd 21621 root txt REG 0,179 312372 30417878 /usr/sbin/httpd | |
httpd 21621 root mem REG 0,179 46680 7938536 /lib/libnss_files-2.5.so | |
httpd 21621 root mem REG 0,179 13420 7938518 /lib/libutil-2.5.so | |
httpd 21621 root mem REG 0,179 1611095 14621180 /usr/lib/httpd/modules/mod_python.so | |
httpd 21621 root mem REG 0,179 30300 14625108 /usr/lib/httpd/modules/mod_proxy_ajp.so | |
httpd 21621 root mem REG 0,179 5500 14625070 /usr/lib/httpd/modules/mod_version.so | |
httpd 21621 root mem REG 0,179 22136 14625164 /usr/lib/httpd/modules/mod_cgi.so | |
httpd 21621 root mem REG 0,179 22076 14625080 /usr/lib/httpd/modules/mod_mem_cache.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.gis.db import models | |
from django.contrib.gis.geos import Point | |
class Multipolygon(models.Model): | |
""" | |
Try using it with this: http://github.com/palewire/latimes-mappingla-geopy | |
""" | |
name = models.CharField(max_length=200, null=True, blank=True) | |
multipolygon = models.MultiPolygonField(srid=2229, null=True, blank=True) | |
objects = models.GeoManager() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Utilities for reading data from PDF files. | |
Lifted from EveryBlock source code. | |
These require the pdftotext binary, available in the Xpdf package: | |
http://www.foolabs.com/xpdf/download.html | |
""" | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"project":{"id":null,"title":"This is bad test","description":null,"document_ids":[]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AP_STATES_NORMALIZATION = { | |
'ak': 'Alaska', | |
'al': 'Ala.', | |
'ala': 'Ala.', | |
'alabama': 'Ala.', | |
'alaska': 'Alaska', | |
'american samao': 'A.S.', | |
'american samoa': 'A.S.', | |
'ar': 'Ark.', | |
'ariz': 'Ariz.', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from django.contrib.gis.geos import Point | |
class Cartogram(object): | |
""" | |
Takes a GeoDjango queryset and creates a cartogram of circles based on | |
the Dorling algorithm. | |
User must provide a queryset and strings pointing to the data attribute |
OlderNewer