Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Van Wazer willvanwazer

View GitHub Profile
@willvanwazer
willvanwazer / parse.py
Created Sep 23, 2015
A snippet of code from the Washington Post's internal story API to process iframes.
View parse.py
# And now we get into the fun rando ones
# First up, vevo! https://www.eff.org/https-everywhere/atlas/domains/vevo.com.html
elif 'http://cache.vevo.com/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://cache.vevo.com/', 'https://scache.vevo.com/')
# Next up YouTube
elif 'http://www.youtube.com/' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://www.youtube.com/', 'https://www.youtube.com/')
# Gfycat http://gfycat.com
elif 'http://gfycat.com' in iframe['src']:
iframe['src'] = iframe['src'].replace('http://gfycat.com/', 'https://gfycat.com/')
View keybase.md

Keybase proof

I hereby claim:

  • I am willvanwazer on github.
  • I am willvanwazer (https://keybase.io/willvanwazer) on keybase.
  • I have a public key whose fingerprint is 4CA2 494B 210C 0007 95A0 C24F FDF5 98BD 9248 AD83

To claim this, I am signing this object:

View feedwrangler.py
import requests
CLIENT_KEY=""
EMAIL=""
PASSWORD=""
AUTHORIZE_ENDPOINT="http://feedwrangler.net/api/v2/users/authorize?email=%s&password=%s&client_key=%s" % (EMAIL, PASSWORD, CLIENT_KEY)
authorize = requests.get(AUTHORIZE_ENDPOINT)
access_token = authorize.json()['access_token']
@willvanwazer
willvanwazer / redirect.py
Last active Dec 15, 2015
Change in Django Redirects
View redirect.py
# In Django 1.4, this works fine:
from django.conf.urls.defaults import patterns, include, url
from django.views.generic.simple import redirect_to
urlpatterns = patterns('',
url(r'^redirect/', redirect_to, {'url': 'http://foo'}),
)
# In Django 1.5, it is changed to this:
from django.conf.urls.defaults import patterns, include, url
View jboss
#!/bin/sh
# Load JBoss AS init.d configuration.
if [ -z "$JBOSS_CONF" ]; then
JBOSS_CONF="/etc/jboss/jboss.conf"
fi
[ -r "$JBOSS_CONF" ] && . "${JBOSS_CONF}"
if [ -z "$JBOSS_HOME" ]; then
View evansmith
package com.washingtonpost.mentionmachine.processing.beans;
import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Singleton;
import java.util.Calendar;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.*;
You can’t perform that action at this time.