Skip to content

Instantly share code, notes, and snippets.

@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>
@gnunicorn
gnunicorn / soundcloud-mm.py
Created December 1, 2011 16:18
soundcloud multimedia keys for linux
#!/usr/bin/env python
"""
Toggle Play-Pause of soundcloud running in your chrome (you obvisouly started with '--remote-shell-port=9222').
inspired (and largely copied) from:
http://code.google.com/p/mog-mm/
"""
import socket
@gnunicorn
gnunicorn / modernizr-snippet.js
Created January 2, 2012 13:54
Nachbarschaftsauto Photo stack Animation
var photo_stack_speed = 7500;
Modernizr.load([
{
load: '//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js',
complete: function() {
if (!window.jQuery) {
Modernizr.load('/js/libs/jquery-1.5.2.min.js');
}
}
},
/*
* Mass Emailer Google Spreadsheet script.
*
* Changelog:
*
* 27. Apr. 2013
* - trial checkbox allows easier debugging
* 16. Feb. 2012
* - released the first version to public
* 15. Feb. 2012
@gnunicorn
gnunicorn / gist:2352035
Created April 10, 2012 15:08
memcache extension for Jinja2 on Google AppEngine
from google.appengine.api import memcache
from jinja2 import nodes
from jinja2.ext import Extension, next
"""
A great Jinja2 Extension for quicker caching of fully rendered content using
Memcache on AppEngine.
@gnunicorn
gnunicorn / gist:3032616
Created July 2, 2012 10:44
zmq install error mac
npm http GET https://registry.npmjs.org/zmq
npm http 304 https://registry.npmjs.org/zmq
> zmq@2.1.0 preinstall /Users/benjaminkampmann/dev/node_modules/zmq
> node-waf clean || (exit 0); node-waf configure build
Nothing to clean (project not configured)
Setting srcdir to : /Users/benjaminkampmann/dev/node_modules/zmq
Setting blddir to : /Users/benjaminkampmann/dev/node_modules/zmq/build
Checking for program g++ or c++ : /usr/bin/g++
@gnunicorn
gnunicorn / sign_me_into_sndcld.py
Created September 2, 2012 08:32
oauth2 authentiaction stream for soundcloud
import BaseHTTPServer
import soundcloud
import urlparse
"""
A simple server for Soundcloud OAuth2 authentication for test cases.
Please make sure the callback for your app is set to http://localhost:10101/callback.
After you've provided the credentials as follows, open your browser and point it to
http://localhost:10101/ - it will immediatly redirect you to soundcloud where you login
@gnunicorn
gnunicorn / gist:3748738
Created September 19, 2012 09:43
Git for Beginners: Call for Coaches

The OpenTechSchool has set up and hosted a few tech workshops and meetups here in Berlin now. Aside from the monthly Beginners Meetup and hosting the Udacity Global Meetup we hosted workshops for program beginners in Python and Javascript on our own and on the premise of CampusParty.

One thing that was extraordinary popular on CampusParty was the Workshop on Git for beginners. And we decided to do it again, this time with a closer focus on version control as a major benefit in code sharing (by using git and github) for beginners - free of charge.

So if you are interested in

include:
- git
repo:
git.latest:
- name: ssh://git@bitbucket.org/crowdbet/infrastructure.git
- rev : master
- target: /home/ubuntu/crowdbet
- runas: ubuntu
- require:
[INFO ] Returning information for job: 20121012155352259003
[INFO ] No changes made for python2.7 bootstrap.py
[INFO ] Executing state cmd.mod_watch for python2.7 bootstrap.py
[INFO ] Executing command /usr/bin/test -f bin/buildout as user ubuntu in directory /home/ubuntu/crowdbet
[INFO ] No changes made for python2.7 bootstrap.py
[INFO ] Executing state cmd.mod_watch for python2.7 bootstrap.py
[WARNING ] The minion function caused an exception: Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/salt/minion.py", line 284, in _thread_return
ret['return'] = func(*args, **kw)
File "/usr/lib/pymodules/python2.7/salt/modules/state.py", line 114, in sls