Skip to content

Instantly share code, notes, and snippets.

View bertonha's full-sized avatar

Christofer Bertonha bertonha

View GitHub Profile
@bertonha
bertonha / properties.py
Created June 7, 2012 12:46
tOSM some Ideas
class _BaseProperty(object):
def __set__(self, instance, value):
self._implicid_validation(value)
self.__validate(value)
# this way you dont look every time for attr_name
if not hasattr(self, 'attr_name'):
for attr_name, attr_value in instance.__class__.__dict__.items():
if attr_value == self:
self.attr_name = '_attributename_'+attr_name
@bertonha
bertonha / update.py
Created May 10, 2012 05:25
update projects with version control
#!/usr/bin/env python
import os
import sys
from subprocess import Popen, PIPE
if len(sys.argv) > 1:
path = os.path.abspath(sys.argv[1])
else:
import os
os.environ['QT_API'] = 'pyside'
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, \
NavigationToolbar2QTAgg
class Plot_Area(FigureCanvasQTAgg):
def __init__(self, parent=None):