Skip to content

Instantly share code, notes, and snippets.

@sfelde
sfelde / gist:1853908
Created February 17, 2012 14:54 — forked from honzajavorek/gist:1853867
A readable way how to work with Flask-SQLAlchemy
class Transaction(object):
def __init__(self, db):
self.db = db
def __enter__(self):
return self.db.session
def __exit__(self, type, value, traceback):
@sfelde
sfelde / tree.md
Created June 3, 2012 09:39 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@sfelde
sfelde / fabfile.py
Created July 24, 2012 12:08 — forked from gregglind/fabfile.py
Fabfile for PyMNtos September 2011 Meeting
#!/usr/bin/env python
"""
Example fabfile for PyMNtos September 2011 meeting.
some examples of usage:
$ fab -H somehost -- uname -a
$ fab -H somehost run:'uname -a'
$ fab -d example
@sfelde
sfelde / gist:3370200
Created August 16, 2012 13:46
Match HTML Tag Content
/(\<(?:.*?)\>)([^\<]*)/gm
@sfelde
sfelde / demo.html
Created August 20, 2012 12:46 — forked from sergejmueller/demo.html
Fullscreen API Demo. Denkbar für eShops. Lauffähig unter Firefox, Chrome und Safari.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="author" content="Sergej Müller" />
<link href="style.css" rel="stylesheet" />
<title>Fullscreen Demo</title>
@sfelde
sfelde / launch_sublime_from_terminal.markdown
Created November 11, 2012 19:36 — forked from artero/launch_sublime_from_terminal.markdown
Launch Sublime Text 2 from the Mac OS X Terminal

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation

class BankAccount < ActiveRecord::Base
# Umsätze von start_date bis end_date abrufen
# * passport_type, passphrase, pin und file kommen in dieser Implementation aus der zugrunde liegenden Tabelle.
# * Wenn passport_type = "PinTan" ist, wird die pin verwendet.
# * Wenn passport_type = "RDHNew" ist, wird die Schlüsseldatei aus filename verwendet und mit der passphrase entschlüsselt.
def get_transactions(start_date, end_date)
HBCIUtils.setParam("client.passport.#{passport_type}.filename", filename)
HBCIUtils.setParam("client.passport.#{passport_type}.init", '1')

Mac で Nginx

インストール

$ brew install nginx

インストールされる場所:

/usr/local/Cellar/nginx/1.2.4/

(Inspired by http://yourmacguy.wordpress.com/2012/06/29/osx-automount/)

Preface:

  • I have a lot of vagrant projects
  • Each of them provides an NFS-Server exporting /home/vagrant
  • Since Mac OS 10.8 the handy "NFS Mounts" from Disk Util are gone
  • I'd like a single place, in which I could copy'n'paste a config for a new box and/or comment a box (when I don't need it for some time)
  • I'd like to make this a vagrant plugin
  • Ideally, the mount will be activated/deactivated when starting/suspending a box
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<ROOT type="array">
<type>array</type>
<el type="array">
<headline type="array">
<TCEforms type="array">
<label>Überschrift</label>
<config type="array">
<type>input</type>