Skip to content

Instantly share code, notes, and snippets.

zerocrates /
Created Aug 12, 2011
Python Trac ticket to Github issue importer for Issues API v3
#!/usr/bin/env python
#be lazy about unicode
import sys; reload(sys); sys.setdefaultencoding('utf-8');
import sqlite3
import urllib2
import json
import base64
import re
zerocrates / gist:1029997
Created Jun 16, 2011
modified WEB_ROOT definition for Omeka to handle non-standard ports
View gist:1029997
function _define_web_root()
// Create base URL
$base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
// As $_SERVER['HTTP_HOST'] is user input, ensure it only contains
// characters allowed in hostnames.
$base_url = $base_root .= '://' . preg_replace('/[^a-z0-9-:._]/i', '', $_SERVER['HTTP_HOST']);
// Handle non-standard ports