Skip to content

Instantly share code, notes, and snippets.

View benspaulding's full-sized avatar

Ben Spaulding benspaulding

View GitHub Profile
diff --git a/gift-4-u.txt b/gift-4-u.txt
index ca36d0a..986e9c4 100644
--- a/gift-4-u.txt
+++ b/gift-4-u.txt
@@ -1,2 +1,2 @@
-I am sending this because you love patch files. :)
+I am sending this because you *really* love patch files. :)
From 99ca027e7f09c5a7dfd0e6804cc90325c223ffea Mon Sep 17 00:00:00 2001
From: Ben Spaulding <ben@benspaulding.com>
Date: Fri, 20 Mar 2009 00:17:14 -0500
Subject: [PATCH] Created ``or_nothing`` filter in default filters.
The same thing can be accomplished with the ``default``
filter and an empty argument, but that feels hacky and
it looks dirty, too.
---
django/template/defaultfilters.py | 11 +++++++++++
From c693dfaa46218537fb66e6e30638ee81f5374fac Mon Sep 17 00:00:00 2001
From: Ben Spaulding <ben@benspaulding.com>
Date: Fri, 20 Mar 2009 00:22:21 -0500
Subject: [PATCH] Created ``yes`` filter in default filters.
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
I cannot count the times that I wanted to output a string if
the value was true, but output nothing otherwise. This leads
#!/bin/sh
echo Starting lighttpd
# What does this do?
exec 2>&1
# Is there a reason for doing this rather than ``exec /etc/init.d/nginx start`` ?
exec /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
class Foo(object):
bar = ['this', 'that']
class Baz(Foo):
# What is the best way to make the bar attr equal to the super class’s
# bar attr with some more items appended to the list?
#
# This obviously doesn't work, but it is the sort of thing I want.
# Middlware munging in staging settings.py
REMOVED_MIDDLEWARE_CLASSES = (
'django.middleware.cache.UpdateCacheMiddleware',
'django.middleware.cache.FetchFromCacheMiddleware',
)
ORIGINAL_MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES
MIDDLEWARE_CLASSES = []
for mwc in ORIGINAL_MIDDLEWARE_CLASSES:
if not mwc in REMOVED_MIDDLEWARE_CLASSES:
MIDDLEWARE_CLASSES.append(mwc)
@benspaulding
benspaulding / models.py
Created June 16, 2009 02:22
Asking for some QuerySet help
from django.db import models
class ThingManager(models.Manager):
"""A manager for public Thing objects."""
def get_query_set(self):
return super(ThingManager, self).get_query_set() # How can I
# get a QuerySet that returns all Thing objects that have at least
# one related Piece object whose is_public attr is True?
$ git show HEAD
error: inflate: data stream error (incorrect header check)
error: corrupt loose object 'd8f69614ed296c2c033ba4a6a558d4c2cc76fe63'
fatal: object d8f69614ed296c2c033ba4a6a558d4c2cc76fe63 is corrupted
/* Fix Redmine issue table issue.
This issue is only an issue with Webkit. Issue.
Something to do with the avatar float and the
table width … uhh … issue. So, one could say this
is a Webkit issue. :)
*/
div.issue.details table[width="100%"] {
width: 85% !important;
}
@benspaulding
benspaulding / restart-bowtie.scpt
Created January 5, 2010 18:28
AppleScript that quits and relaunches Bowtie.
(*
AppleScript that quits and relaunches Bowtie. Bowtie has some
issues on Mac OS 10.6 and frequently needs restarted.
*)
set bowtieApp to application "Bowtie"
tell bowtieApp to quit
try
tell bowtieApp to run