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 / mysql_dump
Created May 9, 2012 08:22
mysqldump with gzip
#!/bin/bash
#MAILTO=mail@domain.ltd
USER='uname'
PWD='password'
DBNAME='dbname'
DATE=`date +%y%m%d.%H%M`
#backup db
mysqldump --default-character-set="UTF8" --extended-insert=FALSE -u$USER -p$PWD $DBNAME | gzip > $DATE.stage.sql.gz
@sfelde
sfelde / typoscript meta
Created May 9, 2012 14:13
typoscript meta tags
page.meta.keywords.data = register:newsKeywords // field : keywords // levelfield:-1,keywords,slide
page.meta.description.data = register:newsSubheader // field : description // levelfield:-1,description,slide
#add in localconf.php
$TYPO3_CONF_VARS['FE']['addRootLineFields'] = ',description,keywords';
@sfelde
sfelde / mac-version
Created May 10, 2012 21:14
mac verion with python
python -c "import platform; print platform.mac_ver()"
@sfelde
sfelde / gist:2658755
Created May 11, 2012 10:14
virtualenv mac 10.5
virtualenv -p /usr/bin/python sfvirtualenv
cd sfvirtualevn
source bin/activate
@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 / nginx-oxid
Created July 3, 2012 17:05
oxid mit nginx
server {
# Hier die eigene VHost-Konfiguration einfügen
# listen, server_name, root, access_log, error_log, index
# OXID eShop Rewrite Regeln
set $script_name $fastcgi_script_name;
set $fcgi_php 127.0.0.1:9000;
# Im Admin und Setup wird kein Rewrite auf die oxseo.php benötigt.
location ~ ^/(setup|admin)/?$ {
@sfelde
sfelde / nginx-oxid
Created July 3, 2012 17:09
oxid-nginx params
fastcgi_param SCRIPT_FILENAME $document_root$script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
@sfelde
sfelde / oxid-seo
Created July 11, 2012 12:45
seo oxid
public function getShopUrl(){
return $this->getConfig()->getShopUrl();
}
public function setSpeakingUrl($speakingUrl)
{
$this->_speakingUrl = $speakingUrl;
}
@sfelde
sfelde / gist:3135375
Created July 18, 2012 10:06
oxid config param (config.inc.php)
$this->getViewConfig()->getOxConfigParameter('name');
#new
oxConfig::getInstance()->getConfigParam('name');
in config.inc.php or local conf
$this->name = 'value';