Skip to content

Instantly share code, notes, and snippets.

@lettertwo
lettertwo / gist:7035980
Created October 18, 2013 03:16
sakabako/scrollMonitor#18
<html>
<head>
<style type="text/css" media="screen">
.spacer {
display: block;
height: 1600px;
}
.block {
display: block;
@lettertwo
lettertwo / absurl.py
Created April 27, 2011 22:35
A template tag to create an absolute URI.
from django.template import Library
from django.templatetags.future import URLNode, url
register = Library()
class AbsoluteURLNode(URLNode):
def __init__(self, view_name, args, kwargs, asvar, legacy_view_name=True):
super(AbsoluteURLNode, self).__init__(view_name,
args,
kwargs,
@lettertwo
lettertwo / gist:740721
Created December 14, 2010 17:12
Detects which mode mod_wsgi is running in
# Detect which mode the wsgi module is in.
# Uncomment this to see whether or not the wsgi module is in daemon mode, which is necessary for the monitor.
def application(environ, start_response):
status = '200 OK'
if not environ['mod_wsgi.process_group']:
output = 'EMBEDDED MODE'
else:
output = 'DAEMON MODE'
import os, os.path
import sys
# Unless your project is already on your PYTHONPATH by default, you need to add it:
# project_directory should point to your project's parent directory.
project_directory = os.path.join(os.path.dirname(__file__), '..')
if project_directory not in sys.path:
sys.path.append(project_directory);
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'