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 os | |
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__)) | |
ADMINS = (('Your Name', 'your_email@domain.com'),) | |
ADMIN_MEDIA_PREFIX = '/static/admin/' | |
DATABASES = { | |
'default': { | |
'ENGINE': 'django.db.backends.postgresql_psycopg2', | |
'NAME': '', | |
'USER': '', |
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
gemcutter => redis downloads spec | |
================================= | |
keys | |
---- | |
downloads => global counter for all gem downloads | |
downloads:today => sorted set for downloads from today | |
downloads:rubygem:rails => counter for all rails downloads | |
downloads:version:rails-2.3.5 => counter for all rails 2.3.5 downloads |
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
upstream wsgidav { | |
server unix:/tmp/wsgidav.sock fail_timeout=0; | |
} | |
# non-HTTPS redirect elided... | |
server { | |
listen 443; | |
server_name dav.domain.com; | |
access_log /var/log/nginx/dav.domain.com.access.log; |
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 __future__ import with_statement # py2.5 | |
from contextlib import contextmanager | |
import logging | |
@contextmanager | |
def log_execution_time(log_msg): | |
""" | |
Context manager which logs the time spent doing a | |
particular activity. |
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
Check if a site it running PHP by appending this query string... | |
?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 | |
Example: | |
http://php.net/?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000 |
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
require 'sj' | |
run SinatraJekyll |
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
// Example of how to cache the result of an external jQuery Template. | |
// Inspired by this post... | |
// http://encosia.com/2010/10/05/using-external-templates-with-jquery-templates/ | |
var person = {name: 'Dave'}; | |
var person_tmpl; | |
$.get('_template.tpl.html', function(template) { | |
// Use converted string from remote file. |
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 mechanize | |
from xml.etree import cElementTree | |
USERNAME = '...' | |
PASSWORD = '...' | |
NUMBER = '2025551212' | |
br = mechanize.Browser() | |
br.open('https://ebillpay.verizonwireless.com/vzw/accountholder/overview/AccountOverview.action') |
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.shortcuts import get_object_or_404, render_to_response | |
from django.template import RequestContext | |
from myapp.models import Note | |
def note_detail(request, slug): | |
note = get_object_or_404(Note, slug=slug) | |
editable = request.user.is_authenticated and request.user.id == note.author.id | |
return render_to_response('myapp/note_detail.html', { |
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 haystack.indexes import * | |
from haystack import site | |
from cab.models import Snippet | |
class SnippetIndex(SearchIndex): | |
text = CharField(document=True, use_template=True) | |
author = CharField(model_attr='author__username') | |
title = CharField(model_attr='title') | |
tags = CharField() | |
tag_list = MultiValueField() |
OlderNewer