Skip to content

Instantly share code, notes, and snippets.

# fabconf.py
import os
import time
from fabric.api import *
from fabric.contrib import django
django.settings_module('mostlymeta.settings')
from django.conf import settings
env.fab_root = os.path.dirname(__file__)
@mostlymeta
mostlymeta / gist:1587652
Created January 10, 2012 07:28
example 5
$(function(){
$('#example5').locationField().bind('location_updated', function(e, location){
$('#example5_city').val(location.city);
$('#example5_state').val(location.state);
});
});
@mostlymeta
mostlymeta / gist:1587542
Created January 10, 2012 06:58
example 4
$(function(){
$('#example4').locationField();
});
@mostlymeta
mostlymeta / gist:1587449
Created January 10, 2012 06:35
jquery.locationField
(function ($){
var locations = [{"country":"CA","longitude":"-67.13060000","city":"Campbell Settlement York Co","latitude":"45.96670000","state":"NB"},{"country":"CA","longitude":"-79.33730000","city":"East York","latitude":"43.72940000","state":"ON"},{"country":"US","longitude":"-76.67785000","city":"East York","latitude":"39.97689800","state":"PA"},{"country":"CA","longitude":"-66.68430000","city":"French Village-York","latitude":"45.96390000","state":"NB"},{"country":"CA","longitude":"-67.00120000","city":"Harvey York Co","latitude":"45.73070000","state":"NB"},{"country":"CA","longitude":"-67.55970000","city":"Johnson Settlement York Co","latitude":"46.16470000","state":"NB"},{"country":"US","longitude":"-90.75393000","city":"Little York","latitude":"41.01066600","state":"IL"},{"country":"US","longitude":"-85.90405000","city":"Little York","latitude":"38.70052300","state":"IN"},{"country":"US","longitude":"-73.99653000","city":"New York","latitude":"40.75074200","state":"NY"},{"country":"US","longitude
@mostlymeta
mostlymeta / gist:1587376
Created January 10, 2012 06:20
example 3
$(function(){
var update_example3 = function(location) {
if (location) {
address = location.city + ", " + location.state + ", " + location.country;
if (!locations[address]) {
locations[address] = location;
}
$('#example3').val(address);
}
validate_example3();
@mostlymeta
mostlymeta / gist:1586865
Created January 10, 2012 04:06
example 2
$(function(){
$('#example2').bind('blur change', function(){
var $this = $(this);
geocode_address($this.val(), function(location){
if (location.formatted_address) {
$this.val(location.formatted_address);
$('#example2_city').val(location.city);
$('#example2_state').val(location.state);
} else {
$this.addClass('error');
@mostlymeta
mostlymeta / gist:1586705
Created January 10, 2012 03:27
example 1
$(function(){
$('#example1').bind('blur change', function(){
var $this = $(this);
geocode_address($this.val(), function(location){
if (location.formatted_address) {
$this.val(location.formatted_address);
$this.removeClass('error');
} else {
$this.addClass('error');
}
@mostlymeta
mostlymeta / gist:1586292
Created January 10, 2012 01:46
geocoding wrapper
var geocoder,
geocode_address,
geocoded_addresses = {},
location_type = {
administrative_area_level_1: 'state',
administrative_area_level_2: 'municipality',
locality: 'city',
country: 'country',
postal_code: 'postal_code',
street_number: 'street_number',