Skip to content

Instantly share code, notes, and snippets.

View rawrgulmuffins's full-sized avatar

Alex LordThorsen rawrgulmuffins

View GitHub Profile
@LilyFoote
LilyFoote / reusable.py
Last active March 8, 2021 22:30
A reusable generator
def reusable(generator):
"""Convert a generator into a ReusableIterator."""
class ReusableIterator:
"""Create an wrapper for a generator to allow repeated iteration."""
def __init__(self, *args, **kwargs):
"""Store the arguments to pass to the wrapped generator."""
self.args = args
self.kwargs = kwargs
@KonradIT
KonradIT / readme.md
Last active September 25, 2023 01:55
GoPro Studio for Linux
@maximebf
maximebf / gist:3986659
Created October 31, 2012 11:56
Jinja2 macro to render WTForms fields with Twitter Bootstrap
{% macro form_field(field) -%}
{% set with_label = kwargs.pop('with_label', False) %}
{% set placeholder = '' %}
{% if not with_label %}
{% set placeholder = field.label.text %}
{% endif %}
<div class="control-group {% if field.errors %}error{% endif %}">
{% if with_label %}
<label for="{{ field.id }}" class="control-label">
{{ field.label.text }}{% if field.flags.required %} *{% endif %}:
@gnunicorn
gnunicorn / forms.html
Created October 13, 2011 16:02
Jinja2 WTForms macros for twitter bootstrap
{%- macro form_field_label(field) -%}
<label for="{{ field.id }}">{{ field.label.text }}
{%- if field.flags.required -%}
<abbr title="Diese Feld muss angegeben werden">*</abbr>
{%- endif %}</label>
{% endmacro %}
{%- macro form_field_description(field) -%}
{% if field.description %}
<span class="descr">{{ field.description }}</span>
@ches
ches / install-pygtk.sh
Created July 20, 2011 11:34
Install PyGTK via Homebrew and virtualenv
# This LOOKS pretty straightforward, but it took awhile to sort out issues with
# py2cairo and pygobject, so I hope I've saved you some time :-)
#
# This assumes you already subscribe to a nice clean virtualenvwrapper workflow
# -- see https://gist.github.com/771394 if you need advice on getting there.
# There are some optional dependencies omitted, so if you're going to be doing
# heavy development with these libs, you may want to look into them.
#
# We go to some configure option pains to avoid polluting the system-level
# Python, and `brew link`ing Cairo which is keg-only by default.