Skip to content

Instantly share code, notes, and snippets.

View bbangert's full-sized avatar
🦊
Numb Numb

Ben Bangert bbangert

🦊
Numb Numb
View GitHub Profile
@bbangert
bbangert / rub_before.py
Created October 28, 2010 01:44
Late night boredom
import inspect
import re
class run_before(object):
"""Takes a function, and returns a class/method decorator"""
def __init__(self, func, name_descriminator=r'[^_]+'):
"""Initialize the run_before decorator
Takes a func that will be called every time before any of the
classes methods (or a function itself if directly decorated).
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ofCode</title>
<meta name="google-site-verification" content="mNd96hqqJrfLl0D_QwRfLby5MWWqxHS1pZqqr92aJSQ" /
<!--[if IE]>
<script src="http://assets1.ofcode.org/javascripts/html5.js"></script>
<![endif]-->
% if c.sub_domain == 'paste':