This file contains hidden or 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
// Adapted from https://medium.com/@ryancatalani/creating-consistently-curved-lines-on-leaflet-b59bc03fa9dc | |
// Drop-in replacement for Leaflet.curve https://github.com/elfalem/Leaflet.curve | |
// To auto-calculate the midpoint for you and ease code integration a bit. | |
// Have fun and defund the police 👍 | |
L.CurvedLine = L.Curve.extend({ | |
_setPath: function(path){ |
This file contains hidden or 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
# Python requests and urllib3 ( and PyQuery, and other tools that build on requests ) | |
# will hang if it encounters poorly-formed HTTP headers with trailing white space | |
# in the header field names. | |
# this is a deliberate choice on the authors' part, | |
# in line with the RFC https://greenbytes.de/tech/webdav/rfc7230.html#header.fields | |
# presumably because extra janky white space can create a security risk. | |
# the right thing to do in such a situation is to contact the adminstrator | |
# of the web site and get them to fix this condition, |
This file contains hidden or 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
Uncategorized: | |
Bitter Lake | |
Broadview | |
Bryant | |
Crown Hill | |
Fremont | |
Georgetown | |
Green Lake | |
Greenwood | |
Harbor Island |
This file contains hidden or 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.conf import settings | |
from django.core.management.base import BaseCommand, CommandError | |
from dateutil import parser | |
import os, untangle | |
class Command(BaseCommand): | |
ATTRIBUTE_TYPES = { | |
'OID': 'IntegerField', |
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 11 columns, instead of 1 in line 8.
This file contains hidden or 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
state,first_name,last_name,address1,address2,city,state_abbr,zip,phone,fax,url | |
Alabama,Kay,Ivey,State Capitol,600 Dexter Avenue,Montgomery,AL,36130-2751,334-242-7100,334-353-0004,http://www.governor.alabama.gov/ | |
Alaska,Bill,Walker,State Capitol,P.O. Box 110001,Juneau,AK,99811-0001,907-465-3500,907-465-3532,http://gov.state.ak.us/ | |
American Samoa,Lolo Matalasi,Moliga,Executive Office Building,Third Floor,"Utulei, Pago Pago",AS,96799,011-684-633-4116,011-684-633-2269,https://www.americansamoa.gov/office-of-the-governor | |
Arizona,Doug,Ducey,State Capitol,1700 West Washington,Phoenix,AZ,85007,602-542-4331,602-542-7601,http://www.governor.state.az.us/ | |
Arkansas,Asa,Hutchinson,State Capitol,Room 250,Little Rock,AR,72201,501-682-2345,501-682-1382,http://www.arkansas.gov/governor/ | |
California,Edmund,Brown,State Capitol,Sute 1173,Sacramento,CA,95814,916-445-2841,916-558-3160,http://gov.ca.gov/ | |
Colorado,John,Hickenlooper,136 State Capitol,,Denver,CO,80203-1792,303-866-2471,303-866-2003,http://www.colorado.gov/governor/ | |
Conn |
This file contains hidden or 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
# usage: | |
# from django.contrib.gis.db import models | |
# from fields import CachedMultiPolygonField | |
# | |
# | |
# class MyGeography(models.model): | |
# name = models.CharField(max_length=128) | |
# geom = models.MultiPolygonField(srid=4326, null=True, blank=True) | |
# geom_cache = CachedMultiPolygonField(field_name='geom', simplify=0.0002, precision=4) |
This file contains hidden or 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
# put lots of SEO friendly terms in the title for Googlers / Stack Overflow crawlers like myself... | |
# basically, tricks to make pulling down shapefiles much smaller file size, ergo faster web sites | |
# control test was 1.2MB of GeoJSON for three polygon shapes... | |
from django.contrib.gis.db.models.functions import AsGeoJSON | |
from django.db.models.expressions import RawSQL | |
from django.views.generic import TemplateView | |
from .models import City |
This file contains hidden or 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 requests | |
SLACK_API_TOKEN = "xoxo-asdfghjkl..." # get one from https://api.slack.com/docs/oauth-test-tokens | |
CHANNEL_NAME = "general" | |
channel_list = requests.get('https://slack.com/api/channels.list?token=%s' % SLACK_API_TOKEN).json()['channels'] | |
channel = filter(lambda c: c['name'] == CHANNEL_NAME, channel_list)[0] | |
channel_info = requests.get('https://slack.com/api/channels.info?token=%s&channel=%s' % (SLACK_API_TOKEN, channel['id'])).json()['channel'] | |
members = channel_info['members'] |
This file contains hidden or 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 awsfabrictasks.ec2.api import * | |
from fabric.api import * | |
from functools import wraps | |
import boto3 | |
import time | |
def aws_hosts(load_balancers): | |
This file contains hidden or 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
# do: | |
# pip install beautifulsoup4 requests | |
# then this: | |
import requests | |
from bs4 import BeautifulSoup | |
# this cookie triggers / forces its new layout (as of July 1 2016) | |
headers = { | |
'Cookie': 'flow=%7B%22DONATION%22%3A%22d_ad_v2a%22%7D' |
NewerOlder