Skip to content

Instantly share code, notes, and snippets.

View mintchaos's full-sized avatar

Christian Metts mintchaos

View GitHub Profile

gitosis -- software for hosting git repositories

Manage git repositories, provide access to them over SSH, with tight access control and not needing shell accounts.

Note

Documentation is still lacking, and non-default configurations

#!/usr/bin/env python
#
# some bits stolen from Travis Cline's http://github.com/traviscline/git-branchdescriptions
#
import os
import re
import sys
from subprocess import Popen, PIPE
# in ~/.gitconfig
[alias]
svnpull = !git stash && git svn rebase && git stash pop
svnpush = !git stash && git svn dcommit && git stash pop
<li class="formrow formrow_{{ field.name }}{% if errors %} has_errors{% endif %}{% if not field.field.required %} optional{% else %} required{% endif %}">
<label for="{{ field.auto_id }}">{{ field.label }}{% if not field.field.required %}<em> (optional)</em>{% endif %}</label>
{{ errors }}
{{ field }}
<small class="help_text">{{ help_text }}</small>{{ hiddenfields }}
</li>
@register.filter
def exclude_fields(form, field_names):
"""
Returns the fields of a Form excluding the named fields. Usage:
{% for field in form|exclude_fields:"field1,field2,field3" %}
"""
fields = []
if isinstance(form, BaseForm):
field_names = field_names.split(',')
for field in form.fields:
// This returns a list of strings of everything my nav links to.
// Like this ['#weddings', '#contact', '#etc']
var sections = $.map($("#main-header a"), function(e){ var h = $(e).attr('href'); if (h.length > 1) { return h } });
// This turns that list into a jquery collection of the linked elements.
sections = $(sections.join())
function activateNav(e) {
// kill all active states
$('#main-header li').removeClass('active');
@mintchaos
mintchaos / gist:1028150
Created June 15, 2011 21:22
ReCSS bookmarklet
javascript:void(function(){var%20i,a,s;a=document.getElementsByTagName('link');for(i=0;i%3Ca.length;i++){s=a[i];if(s.rel.toLowerCase().indexOf('stylesheet')%3E=0&&s.href)%20{var%20h=s.href.replace(/(&|%5C?)forceReload=\d+/,'');s.href=h+(h.indexOf('?')%3E=0?'&':'?')+'forceReload='+(new%20Date().valueOf())}}})();
@mintchaos
mintchaos / snippet.py
Created July 27, 2012 18:25
Uniquify list of dicts by a key.
"""
I have data like this.
I want to uniquify it based in the url. I have written code that works.
But it just seems gross. Is there a straightforward way to do this that I'm missing?
"""
embed_list = [
{
@mintchaos
mintchaos / trailing_commas.py
Created April 24, 2013 20:45
Learning the hard way so you dont' have to.
tweet = Tweet() # new django object
tweet.content = item.content,
tweet.save()
tweet.content == "('%s',)" % item.content # True
# Don't accidentally end your lines with commas kids.

#positivepython

The legendary #django-social channel was once a lovely place of vibrant, cheerful discussion. I miss that.

This experimental channel is a place for off-topic, positive conversation. IRC is a great place to bitch and vent, but #positivepython is not the place for it.

Feel free to invite anyone that you feel should be a part of the group. We want to be selective, not exclusive.