This file contains 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 distutils.core import setup | |
import os | |
# Compile the list of packages available, because distutils doesn't have | |
# an easy way to do this. | |
packages, data_files = [], [] | |
root_dir = os.path.dirname(__file__) | |
if root_dir: | |
os.chdir(root_dir) |
This file contains 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
1. Install Xcode 4 | |
2. Install homebrew. | |
3. brew install python --framework | |
4. brew install libjpeg (for PIL) | |
5. sudo unlink /System/Library/Frameworks/Python.framework/Versions/Current | |
6. sudo ln -s /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/Current /System/Library/Frameworks/Python.framework/Versions/Current | |
7. nano ~/.bash_profile | |
8. add: export PATH=/usr/local/share/python:/usr/local/bin:$PATH | |
9. source ~/.bash_profile (or you can load a new terminal window) | |
10. easy_install pip |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<select class="drilldown"> | |
<option value="">------</option> | |
<option value="1">Books</option> | |
<option value="2">Books > Fiction</option> | |
<option value="3">Books > Fiction > Sci-Fi</option> | |
<option value="4">Books > Fiction > Fantasy</option> |
This file contains 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.db.models.loading import cache | |
from django.db.models.base import ModelBase | |
import sys | |
def override_model(app_label, model_name): | |
caller = sys._getframe(1) # Obtain calling frame | |
module_name = caller.f_globals['__name__'] | |
def decorator(orig_cls): |
This file contains 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
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains 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 datetime | |
import re | |
from django.http import HttpResponseRedirect | |
import requests | |
from django.utils import simplejson | |
reg_b = re.compile(r"android.+mobile|avantgo|bada\\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino", re.I|re.M) | |
reg_v = re.compile(r"1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\\-(n|u)|c55\\/|capi|ccwa|cdm\\-|cell|chtm|cldc|cmd\\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\\-s|devi|dica|dmob|do(c|p)o|ds(12|\\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\\-|_)|g1 u|g560|gene|gf\\-5|g\\-mo|go(\\.w|od)|gr(ad|un)|haie|hcit|hd\\-(m|p|t)|hei\\-|hi(pt|ta)|hp( i|ip)|hs\\-c|ht(c(\\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\\-(20|go|ma |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link rel="stylesheet" href="nanoscroller.css"> | |
<style> |
This file contains 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
;[program:andrewingram-gunicorn] | |
;command=/var/www/andrewingram.net/bin/gunicorn_django /var/www/andrewingram.net/src/andrewingram/andrewingram/settings.py | |
;directory=/var/www/andrewingram.net | |
;logfile=/var/www/andrewingram.net/log/supervisor.log | |
;user=deployer | |
;autostart=true | |
;autorestart=true | |
;redirect_stderr=True | |
[program:andrewingram-uwsgi] |
This file contains 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
server { | |
listen 80; | |
client_max_body_size 4G; | |
server_name andrewingram.net localhost 127.0.0.1; | |
gzip on; | |
gzip_proxied any; | |
gzip_types text/plain application/xml application/x-javascript text/javascript text/css; | |
keepalive_timeout 5; |
This file contains 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
class MimeTemplateView(TemplateView): | |
@classonlymethod | |
def as_view(cls, **kwargs): | |
setattr(cls, 'mimetype', kwargs.pop('mimetype','text/html')) | |
return super(MimeTemplateView, cls).as_view(**kwargs) | |
def render_to_response(self, context, **kwargs): | |
kwargs['mimetype'] = self.mimetype | |
return super(MimeTemplateView, self).render_to_response(context, **kwargs) |
OlderNewer