Skip to content

Instantly share code, notes, and snippets.

View bryanveloso's full-sized avatar

Bryan Veloso bryanveloso

View GitHub Profile
@robhudson
robhudson / clean_settings.py
Created May 28, 2009 14:06
Cleaned up and alphabetical settings
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': '',
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
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;
# 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.
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
require 'sj'
run SinatraJekyll
// 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.
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')
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', {
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()