Skip to content

Instantly share code, notes, and snippets.

What's happening

Armin Ronacher mitsuhiko

What's happening
View GitHub Profile
View gist:10734631
from importlib.machinery import ModuleSpec, SourceFileLoader
from _frozen_importlib import _SpecMethods
path = '/tmp/'
loader = SourceFileLoader('plugin_base', path)
spec = ModuleSpec(name='plugin_base', loader=loader)
mod = _SpecMethods(spec).create()
View bstrie
fn main() {
let numbers = [1, 2, 3];
let keys = ["foo", "bar", "baz"];
for iter::zip(numbers, keys) |&number, &key| {
io::println(fmt!("%s => %d", key, number));
for iter::enumerate(keys) |&index, &key| {
io::println(fmt!("%u => %s", index, key));
View gist:4013696
fn main() {
match os::homedir() {
None => {
io::println("You have no home folder :-(");
Some(ref homedir) => {
io::println("Files in your home folder:");
for os::list_dir_path(homedir).each |path| {
match path.filename() {
Some(ref filename) => io::println(*filename),
View _error_
Debugging middleware caught exception in streamed response at a point where response headers were already sent.
Traceback (most recent call last):
File "/home/max/.virtualenvs/flask/lib/python2.7/site-packages/werkzeug/", line 513, in next
return self._next()
File "/home/max/.virtualenvs/flask/lib/python2.7/site-packages/werkzeug/", line 829, in iter_encoded
for item in self.response:
File "/home/max/.virtualenvs/flask/lib/python2.7/site-packages/jinja2/", line 918, in generate
yield self.environment.handle_exception(exc_info, True)
File "/home/max/Projekte/flask-testing-stuff/templates/index.html", line 1, in top-level template code
{% extends "layout.html" %}
mitsuhiko /
Created Mar 19, 2012
flask-script with wtforms
import sys
from werkzeug.datastructures import ImmutableDict, MultiDict
from flask import request
from flaskext.script import Manager
from postfixmgmt import app, db, __version__
from postfixmgmt.forms import DomainAddForm
manager = Manager(app)