This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from time import sleep | |
import os | |
import re | |
import bonobo | |
from atomicwrites import atomic_write | |
from fs.osfs import OSFS | |
from texools.files import new_file_check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Orignal version taken from http://www.djangosnippets.org/snippets/186/ | |
# Original author: udfalkso | |
# Modified by: Shwagroo Team and Gun.io | |
import sys | |
import os | |
import re | |
import hotshot, hotshot.stats | |
import tempfile | |
import StringIO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Utilities for managing database sessions.""" | |
from __future__ import with_statement | |
import contextlib | |
import functools | |
@contextlib.contextmanager | |
def temp_session(session_cls, **kwargs): | |
"""Quick and dirty context manager that provides a temporary Session object | |
to the nested block. The session is always closed at the end of the block. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stashgrep() { | |
for i in `git stash list | awk -F ':' '{print $1}'`; do | |
git stash show -p $i | grep -H --label="$i" "$1" | |
done | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getXMLHttpRequest() { | |
var xhr = null; | |
if (window.XMLHttpRequest || window.ActiveXObject) { | |
if (window.ActiveXObject) { | |
try { | |
xhr = new ActiveXObject("Msxml2.XMLHTTP"); | |
} catch(e) { | |
xhr = new ActiveXObject("Microsoft.XMLHTTP"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging.handlers | |
import smtplib | |
class BufferingSMTPHandler(logging.handlers.BufferingHandler): | |
def __init__(self, mailhost, fromaddr, toaddrs, subject, capacity): | |
logging.handlers.BufferingHandler.__init__(self, capacity) | |
self.mailhost = mailhost | |
self.mailport = None | |
self.fromaddr = fromaddr | |
if isinstance(toaddrs, (str, unicode)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class myForm extends sfFormDoctrine | |
{ | |
public function processValues($values = null) | |
{ | |
$values = parent::processValues($values); | |
// calculate the value of virtual field "foo" | |
$values['foo'] = $foo; | |
return $values; |