Skip to content

Instantly share code, notes, and snippets.

View groovecoder's full-sized avatar

luke crouch groovecoder

View GitHub Profile
@groovecoder
groovecoder / gist:2399382
Created April 16, 2012 15:13
git aliases
[alias]
st = status --ignore-submodules
stf = status
ci = commit
br = branch
co = checkout
rb = rebase
df = diff
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lol = log --graph --decorate --pretty=oneline --abbrev-commit
" Gist
let g:gist_clip_command='pbcopy'
let g:gist_detect_filetype=1
nnoremap <silent> <Leader>V :'<,'>Gist<CR>
@transaction.commit_on_success(using='default')
def make_breadcrumb_relationships(self, rows):
"""Set the topic_parent for Kuma pages using parent_id"""
log.info("Building parent/child breadcrumb tree...")
for r in rows:
if not r['page_text'].strip():
continue
bc_ids = []
bc_ids.insert(0, r['page_id'])
if r['page_parent']:
class DocumentTag(TagBase):
"""A tag indexing a document"""
class Meta:
verbose_name = _("Document Tag")
verbose_name_plural = _("Document Tags")
class DocumentTag(TagBase):
"""A tag indexing a document"""
class Meta:
verbose_name = _("Document Tag")
verbose_name_plural = _("Document Tags")
DEMO_UPLOADS_ROOT = getattr(settings, 'DEMO_UPLOADS_ROOT',
'%s/uploads/demos' % getattr(settings, 'MEDIA_ROOT', 'media'))
DEMO_UPLOADS_URL = getattr(settings, 'DEMO_UPLOADS_URL',
'%s/uploads/demos' % getattr(settings, 'MEDIA_URL', '/media'))
demo_uploads_fs = FileSystemStorage(location=DEMO_UPLOADS_ROOT, base_url=DEMO_UPLOADS_URL)
DEMO_UPLOADS_ROOT = getattr(settings, 'DEMO_UPLOADS_ROOT',
'%s/uploads/demos' % getattr(settings, 'MEDIA_ROOT', 'media'))
DEMO_UPLOADS_URL = getattr(settings, 'DEMO_UPLOADS_URL',
'%s/uploads/demos' % getattr(settings, 'MEDIA_URL', '/media'))
demo_uploads_fs = FileSystemStorage(location=DEMO_UPLOADS_ROOT, base_url=DEMO_UPLOADS_URL)
@groovecoder
groovecoder / gist:2911473
Created June 11, 2012 17:33
sed command for changing devmo_url calls to new docs urls
sed -i '' -e "s/devmo_url(_('\/en\/\(.*\)'))/'\/docs\/\1/'" templates/base.html
import jingo
from wiki import ReadOnlyException
class ReadOnlyMiddleware(object):
"""
Renders a 403.html page with a flag for a specific message.
"""
def process_exception(self, request, exception):
import pdb; pdb.set_trace()
@groovecoder
groovecoder / gist:3061919
Created July 6, 2012 18:36
developer-new-2012-07-06
commit 3ac0c166e8b32b91ea892ea05c487522956102cf
Merge: 36f8717 f8941b4
Author: David Walsh <davidwalsh83@gmail.com>
Date: Thu Jul 5 13:48:31 2012 -0700
Merge pull request #346 from lmorchard/edit-non-english-765647
fix bug 765647: Properly handle "edit" button as translation request
commit f8941b4077e85ee66485f7fb355fad479280b0a0