Skip to content

Instantly share code, notes, and snippets.

View bfirsh's full-sized avatar
🚀

Ben Firshman bfirsh

🚀
View GitHub Profile

Keybase proof

I hereby claim:

  • I am bfirsh on github.
  • I am bfirsh (https://keybase.io/bfirsh) on keybase.
  • I have a public key whose fingerprint is 2BAA 45BE 087C D66E 81D4 93A4 1829 6449 E36D 2F1E

To claim this, I am signing this object:

@bfirsh
bfirsh / short_urls.py
Created March 8, 2012 21:24
Efficiently expand short URLs
import requests
from urlparse import urlparse, urljoin
URL_SHORTENERS = [
'bit.ly',
'ow.ly',
'dlvr.it',
'fb.me',
'4sq.com',
'is.gd',
@bfirsh
bfirsh / lightning.txt
Created October 6, 2011 22:41 — forked from pycodeconf/lightning.txt
PyCodeConf 2011 Lightning Talk Signup
I want to give a lightning talk about: Automatically testing your CSS (with Python)
I need the projector: yes
from django.test import TestCase
from needle.cases import NeedleTestCase
class MastheadTest(NeedleTestCase, TestCase):
def test_masthead(self):
self.driver.load_html(self.client.get('/').content)
self.assertScreenshot('//*[@id="masthead"]', 'masthead')
@bfirsh
bfirsh / Deploy.applescript
Created April 20, 2011 18:50
Voice deploy!
-- Deploy.applescript
--
-- Deploys the current directory opened in Finder to ep.io
--
-- To install, run:
--
-- $ osacompile -x -o "$HOME/Library/Speech/Speakable Items/Deploy" "Deploy.applescript"
--
-- Go to System Preferences and open the Speech panel. In the "Speech Recognition"
-- tab, turn "Speakable Items" on.
import datetime, time
from collections import defaultdict
events = []
# event = {
# 'uri':'uri'
# "title",
# "abstract"
# "start": 123678,
# "room",
# "difficulty":
from BeautifulSoup import BeautifulSoup
import datetime, time
from collections import defaultdict
import urllib2
talk_abstracts_url = 'http://www.europython.eu/talks/talk_abstracts/index.html'
events = []
# event = {
# 'uri':'uri'
"""
A drop in replacement for {% url %} that generates relative paths.
Just put {% load relative_urls %} at the top of your template, and all {% url %}
calls will generate paths relative to the current request path.
For example, when reversing a URL that points to ``/admin/foo/`` on the page
``/admin/bar/``, it will output ``../foo/``.
"""