View gist:11682
#!/bin/sh | |
# | |
# Cleanup World of Warcraft AddOns folder from embedded libraries, | |
# only if those are installed individually or as part of a library pack (eg. Ace3) | |
# | |
# Usual dir on a Mac OS X is at : | |
# ~/Applications/World of Warcraft/Interface/AddOns | |
# | |
# Useful shell alias |
View rails_vendor_gems_ng.rb
# see mail reply in http://groups.google.com/group/haml/msg/12f63d9dff34a1d5 | |
# with explanation about how/why this works better than rails 2.2 | |
module Rails | |
class VendorGemSourceIndex | |
def gemspec_filename(d) | |
File.join(d,"#{File.basename(d)}.gemspec") | |
end |
View gist:1179782
from google.appengine.api import apiproxy_stub | |
from google.appengine.api import apiproxy_stub_map | |
class FetchServiceMock(apiproxy_stub.APIProxyStub): | |
def __init__(self, service_name='urlfetch'): | |
super(FetchServiceMock, self).__init__(service_name) | |
def set_return_values(self, **kwargs): | |
self.return_values = kwargs |
View profile_middleware.py
from django.core.exceptions import MiddlewareNotUsed | |
from django.conf import settings | |
import cProfile | |
import pstats | |
import marshal | |
from cStringIO import StringIO | |
class ProfileMiddleware(object): | |
def __init__(self): | |
if not settings.DEBUG: |
View sqldump_middleware.py
from django.conf import settings | |
from django.db import connection | |
class SqldumpMiddleware(object): | |
def process_response(self, request, response): | |
if settings.DEBUG and 'sqldump' in request.GET: | |
response.content = str(connection.queries) | |
response['Content-Type'] = 'text/plain' | |
return response |
View django_jinja2_loader.py
import jinja2 | |
from django.template.loader import BaseLoader | |
from django.template.loaders.app_directories import app_template_dirs | |
from django.template import TemplateDoesNotExist, Origin | |
from django.core import urlresolvers | |
from django.conf import settings | |
import datetime | |
import urllib | |
from django.utils.timesince import timesince, timeuntil |
View django_generic_relation_caching.py
from django.db import models | |
from django.contrib.contenttypes.models import ContentType | |
from django.contrib.contenttypes import generic | |
from django.core.cache import cache | |
from django.dispatch import receiver | |
class LabelsManager(models.Manager): | |
""" The manager for Label/s, as well as superclass of the RelatedManager/s of Label/s """ | |
def all(self): |
View sql_mongodb_dump_middleware.py
from django.core.exceptions import MiddlewareNotUsed | |
from django.conf import settings | |
from django.db import connection | |
from pymongo.connection import Connection | |
from time import time | |
import struct | |
import bson | |
from bson.errors import InvalidBSON | |
class SqldumpMiddleware(object): |
View LICENSE
Copyright (c) 2013, Evgeny Zislis | |
All rights reserved. | |
Redistribution and use in source and binary forms, with or without modification, | |
are permitted provided that the following conditions are met: | |
* Redistributions of source code must retain the above copyright notice, | |
this list of conditions and the following disclaimer. | |
* Redistributions in binary form must reproduce the above copyright notice, |
OlderNewer