Skip to content

Instantly share code, notes, and snippets.

@bahoo
bahoo / gist:4422794
Last active December 10, 2015 10:39

Work / Career Ships

  • I shipped going independent. As of January 27th 2012, I left my shift in the agency world to have a go at working on my own.
  • Not five business days later I shipped a very enticing job acceptance to join Simply Measured, hands down my favorite job I've ever had. I'm employee #12.
  • We shipped the all new http://www.simplymeasured.com; a fresh, decidedly more grown-up face for a company on its way to big things.
  • We shipped Simply Measured's Freebie Report Marketplace, http://simplymeasured.com/freebies This helped better acquiant free users with how our subscriber product works, and overall helped unify our product offering.
  • I shipped a brand spankin' new Magento e-comm site for my friends at Peachtree Audio. http://peachtreeaudio.com/
  • On a whim, I signed up to partake in Seattle Creative Mornings' "Battledecks" event, a PowerPoint Karaoke showdown. I ended up shipping first place prize over some formidable opponents. :)
  • I shipped one of my favorite creation
@bahoo
bahoo / gist:6314071
Last active December 21, 2015 13:39
Mr. Kilmer,
Thanks for your response and pardon my delay in getting back to you as
I collected my thoughts.
I appreciate you wanting to take thoughtful time for debate and
consideration on this very serious topic, but I can't help but be a
little underwhelmed at your commitment to improving the situation.
You voted 'no' on the Amash amendment. OK, the author of the PATRIOT
@bahoo
bahoo / gist:6322125
Created August 23, 2013 17:55
Smarter way to add fields to order grid.
<?php
/*
Summoned with:
<config>
<global>
<events>
<sales_order_resource_init_virtual_grid_columns>
<observers>
<capture_order_grid_fields>
@bahoo
bahoo / 2016_presidential_race_us_based_likes.py
Last active February 16, 2016 21:37
Which presidential candidate has the most US based likes on Facebook?
# for context, many marketing teams will buy cheap likes on Facebook by running
# ads in countires where US presidential elections don't take place.
# this can produce misleading counts of "Likes" when you visit their page.
# looking at only US-based likes will give you a more honest assessment of
# relative popularity of the candidates on Facebook in the US.
# but of course, YMMV. :)
import requests
# I can't get these warnings to hide, but w/e.
@bahoo
bahoo / gofundme.py
Created July 2, 2016 00:31
Scrape fundraising progress from GoFundMe
# 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'
@bahoo
bahoo / fabfile.py
Created December 8, 2016 03:54
AWS Application Load Balancer-friendly Fabric Deploys using boto3
from awsfabrictasks.ec2.api import *
from fabric.api import *
from functools import wraps
import boto3
import time
def aws_hosts(load_balancers):
@bahoo
bahoo / export-users-from-slack-channel.py
Created February 2, 2017 21:28
Export users (first name, last name, email address) from a given Slack channel
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']
@bahoo
bahoo / compress-geodjango-polygons.py
Last active May 6, 2020 07:58
Compression / low bandwidth / lower file size tricks with shapefiles / GeoDjango / GIS / Django
# 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
@bahoo
bahoo / fields.py
Created March 12, 2017 02:59
Simplified Geometry Fields for Django
# 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)
@bahoo
bahoo / governors.csv
Last active June 2, 2017 21:43
US Governors Contact Information
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.
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