Skip to content

Instantly share code, notes, and snippets.

View mcdonc's full-sized avatar

Chris McDonough mcdonc

View GitHub Profile
@mcdonc
mcdonc / gist:1272572
Created October 8, 2011 17:13
rev2 of api demo
# framework
from pyramid.view import view_config
import venusian
class api(object):
def __init__(self, **kw):
self.route_pattern = kw.pop('pattern')
self.route_method = kw.pop('method', None)
self.kw = kw
Chris McDonough - 4:49 AM - Limited
It's hard not to notice that the Python Web-SIG is very low-traffic;
surprising given how much Python is used in the web world. It may be that no
one likes to participate unless there's a contentious issue, or it might be
due to balkanization in the Python web community.
Communicating over the web is pretty impersonal and just kind of hard in
general; it's much easier to stick with what you know than to try new things
and become a member of a different community.
With some generosity from Cars.com thanks to Michael Ryabushkin, a
contribution of space from PyCon thanks to Jesse Noller, and some prompting
by Doug Hellmann, if we can get some attendance, we'll able to have a "Web
Development Summit" at PyCon in Santa Clara this year. It will take place on
one of the two "tutorial days" before the conference. It will not compete
with the language summit (that will be on a different day).
The original idea for this took shape as a Google+ post:
"""
django: jacob, adrian, russell keith-mcgee, alex, janis leidel,
danny, steve holden
zope: jim fulton, hanno schlichting, tres seaver, martijn faassen, martin
aspeli, lennart regebro
webob: ian, sergey
flask/werkzeug: armin
cherrypy: robert brewer
wsgi: graham dumpleton, ken cochrane, phillip eby, and clover
web2py: massimo dipierro
turbogears: chris perkins
@mcdonc
mcdonc / gist:3147993
Created July 20, 2012 00:58
bug in code-block rendering
@mcdonc
mcdonc / gist:3890756
Created October 15, 2012 04:03
Chris' Sublime Text 2 Emacsey keybindings
[
// Chris' "emacs refugee" Sublime Text 2 key mappings. Depends on
// sublemacspro and Wrap Plus packages, plus a custom pdb.set_trace snippet
// named set_trace.sublime-snippet. It outs me as someone who uses cursor
// keys; try not to judge.
// "bol"/"eol" goes to a logical begin/end of line; we want it to go to true
// line begin/end, so we use hardbol/hardeol instead for ctrl-a and ctrl-e
@mcdonc
mcdonc / gist:3898894
Created October 16, 2012 12:11
oh my god i'm using emacs to reindent html in sublime text 2
# Sublime's HTML reindenting is currently pretty bad. And Tidy and xmllint
# change my code in ways I don't really like or need. I just need the thing
# reindented sanely. Emacs did that pretty well.
#
# One thing led to another. A few drinks later and now I'm using Emacs to
# reindent HTML from within Sublime.
#
# Save the contents of this file as ohmygodemacs.py in your User directory.
# Then save the contents of the following docstring as ohmygodemacs.elsip in your
# User directory
@mcdonc
mcdonc / gist:3921658
Created October 20, 2012 01:52
ZPT wrapper for tidy-html
#!/usr/bin/env python
# tidy_pt_wrapper lint wrapper for Chameleon and ZPT templates. Written to
# run under SublimeLinter, but will probably work elsewhere.
#
# When run from the command line it invokes tidy-html5 and scrapes and
# modifies its stderr output when acting as a filter, e.g.
#
# tidy_pt_wrapper < some.pt
#
@mcdonc
mcdonc / gist:3977930
Created October 30, 2012 02:17
Emacs: use f5 to find a tox.ini and run it
(require 'compile)
(defun* get-closest-pathname (&optional (file "tox.ini"))
"Determine the pathname of the first instance of FILE starting
from the current directory towards root. This may not do the
correct thing in presence of links. If it does not find FILE,
then it shall return the name of FILE in the current directory,
suitable for creation"
(let ((root (expand-file-name "/")))
(expand-file-name file
{
"cmd": ["findtox"],
"working_dir": "${file_path:${folder}}",
"selector":"source.python"
}