Skip to content

Instantly share code, notes, and snippets.

Satyajit Sarangi H1ccup

Block or report user

Report or block H1ccup

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
H1ccup /
Created May 22, 2014
Python currency formatting.
def format_currency(value, currency, add_symbol=False):
# Check if value exists
if value:
# stores the negative symbol
symbol = ""
formatted_currency = ""
dec = ""
value = str(value)
View SQLAlchemy json serializer
from sqlalchemy.ext.declarative import DeclarativeMeta
class AlchemyEncoder(json.JSONEncoder):
def default(self, obj):
print obj.__public__
if isinstance(obj.__class__, DeclarativeMeta):
fields = {}
for field in [x for x in obj.__public__) if not x.startswith('_') and x != 'metadata']:
You can’t perform that action at this time.