Skip to content

Instantly share code, notes, and snippets.

@asmedrano
asmedrano / gist:2466271
Created Apr 22, 2012
New Twitter Bootstrap row every Nth item.
View gist:2466271
{%for item in items%}
{% if forloop.first or forloop.counter0|divisibleby:3 %}
<div class = "row">
{%endif%}
{# We need to add a new Bootstrap row every after every third item item#}
<div class = "span4">
<h3><a href ="">{{title}}</a></h3>
<span>Posted on {{created_on}} </span>
</div>
@asmedrano
asmedrano / acs2010_sumlev.py
Created Apr 26, 2012
ACS2010 Census Summary Levels as a Dict
View acs2010_sumlev.py
"""
Summary Level Definitions
Defined as:
SUMLEV: (Geographies, Hierarchy(when avail))
"""
SUMLEV = {
'010':('United States', 'United States'),
'020':('Region'),
'030':('Division'),
'040':('State','State'),
View gist:2895558
// a simple addition function
function add_these(num1, num2){
$result = $num1 + $num2;
return $result;
}
@asmedrano
asmedrano / index.html
Created Oct 3, 2012 — forked from enjalot/index.html
Simple Pie Chart example with D3.js
View index.html
<!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.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
@asmedrano
asmedrano / gist:3853932
Created Oct 8, 2012
Setting up a WebView for Ubuntu App Dev
View gist:3853932
import gettext
import os
from gettext import gettext as _
gettext.textdomain('html5test')
from gi.repository import Gtk, WebKit # pylint: disable=E0611
import logging
logger = logging.getLogger('html5test')
from html5test_lib import Window
View gist:3947679
class ScruffySpider(BaseSpider):
name = "scruffy"
allowed_domains = ['constantcontact.com']
start_urls = [
'http://www.constantcontact.com/index.jsp'
]
domain_pattern = re.compile('constantcontact\.com')
mailto_pattern = re.compile('mailto\:')
@asmedrano
asmedrano / fips.sh
Created Nov 16, 2012 — forked from forkandwait/fips.sh
Reworked script for loading tiger data
View fips.sh
declare -A FIPS
declare -A STNAME
FIPS[AK]=02; STNAME[AK]=Alaska
FIPS[AL]=01; STNAME[AL]=Alabama
FIPS[AR]=05; STNAME[AR]=Arkansas
FIPS[AS]=60; STNAME[AS]=American Samoa
FIPS[AZ]=04; STNAME[AZ]=Arizona
FIPS[CA]=06; STNAME[CA]=California
FIPS[CO]=08; STNAME[CO]=Colorado
FIPS[CT]=09; STNAME[CT]=Connecticut
@asmedrano
asmedrano / gist:4627261
Last active Dec 11, 2015
Simple script to download a list of files with wget
View gist:4627261
Give a list like so...
Lets call it list.txt
jquery|http://code.jquery.com/jquery-1.8.3.min.js
modernizr|http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js
pydocs|http://docs.python.org/2/archives/python-2.7.3-docs-html.zip
djangodocs|https://www.djangoproject.com/m/docs/django-docs-1.4-en.zip
leaflet|http://cdn.leafletjs.com/leaflet-0.5/leaflet.js
leafletdocs|http://leafletjs.com/reference.html
@asmedrano
asmedrano / gist:4708675
Created Feb 4, 2013
Get the location of the bash script you are running. Great for making alias..ssss
View gist:4708675
SCRIPTPATH=$(cd "$(dirname "$0")"; pwd)
echo SCRIPTPATH
@asmedrano
asmedrano / gist:6065275
Created Jul 23, 2013
Installing postgis on ubuntu 13.04
View gist:6065275
sudo add-apt-repository ppa:ubuntugis
sudo apt-get update
sudo apt-get install postgis postgresql-9.1-postgis
# youll need this /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql
# and this /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql
# now create a spatially enabled template db
The first step in creating a PostGIS database is to create a simple PostgreSQL database.