Skip to content

Instantly share code, notes, and snippets.

~ % erl -myflag 1
Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9.2 (abort with ^G)
1> init:get_argument(myflag)
1> q()
1> dsahldkj ahsdasd;asldja ddas
1>
package Mail::RFC822::Address;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
require Exporter;
@ISA = qw(Exporter);
# Items to export into callers namespace by default. Note: do not export
from inspect import getmembers, getargspec, ismethod
from functools import wraps
from decorator import decorator
# Some super basic decorators
def std_decorator(f):
def std_wrapper(*args, **kwargs):
return f(*args, **kwargs)
return std_wrapper
from inspect import getmembers, getargspec, ismethod
from functools import wraps
from decorator import decorator
# Some super basic decorators
def std_decorator(f):
def std_wrapper(*args, **kwargs):
return f(*args, **kwargs)
return std_wrapper
@satiani
satiani / gist:6716828
Created September 26, 2013 16:42
20 antimatter condensers for your pleasure. To make this work, copy this and in the Developer Tools console type: document.cookie = "CookieClickerGame=...."
"CookieClickerGame=MS4wMzZ8fDEzODAwMDYyMTYwODd8MTExMTExfDEzNDgwOTg5MDszOTY4MDMyNjI7MTY2NTsyOzI1MzA1MTsxMjstMTstMTswOzA7MDswOzA7MHwwLDEyMSwxNzgyOSwwOzAsMTMsNTk1NCwwOzAsOSwxMzk4OCwwOzAsNDgsMTUyMzA1LDA7MCw1LDI3Nzg5OSwwOzAsOCwxMjQxNDgzLDA7MCwyMCwzMjI2NDEzLDA7MTQsMTQsMzA0NDU4MzEzLDA7MTUsMTUsNDg4MDk2NjIsMDsyMCwyMCwwLDA7fDI5OTM0Njc1MjgyMTkzOTE7MjI1MTgwMjE0MDE0MDIwNzsyMjUxNzk5ODEzNjg1MjQ5OzIyNTE3OTk4MTM2ODUyNzk7NTI0Mjg5fDM1Mzk1NzQ4OTg2ODg1MTE7ODc5NjEwMTY3NzY0MQo=%21END%21; __utma=26628008.63387758.1380213262.1380213262.1380213262.1; __utmb=26628008.3.10.1380213262; __utmc=26628008; __utmz=26628008.1380213262.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __cfduid=da7f74d1af9d9de659fbeace4f84014951380213255852"
@app.teardown_request
def shutdown_request(exc=None):
if exc is not None:
print "An exception happened!"
def test_request_teardown(self):
try:
with self.app.test_request_context():
raise Exception('dummy exception')
except:
rom flask import Flask
app = Flask(__name__)
@app.teardown_request
def teardown(exc = None):
if exc is not None:
print "An exception has occured!"
try:
class TestContext(object):
def __init__(self):
self.entered = False
self.exited = False
def __enter__(self):
self.entered = True
def __exit__(self):
self.exited = True
import sys
class TestContext(object):
def __init__(self):
self.entered = False
self.exited = False
def __enter__(self):
self.entered = True
def __exit__(self, exc_type, exc_value, tb):
self.exited = True
@satiani
satiani / app.py
Last active December 28, 2015 10:59
How to work around the caching of wtforms validator message translations
from flask import Flask, request, jsonify
from flask.ext.wtf import Form, TextField, Email
from flask.ext.babel import get_translations, lazy_gettext as __
from flask.json import JSONEncoder
from speaklater import make_lazy_string, is_lazy_string
class CustomTranslations(object):
def babel_gettext(self, s):
return get_translations().ugettext(s)