Skip to content

Instantly share code, notes, and snippets.

View barakarg's full-sized avatar

Barak Argaman barakarg

View GitHub Profile
@timgit
timgit / megaNumber.js
Last active January 15, 2020 08:35
Large number format filter for Angular written in ES6 that rounds to the specified decimal place (defaults to 1). 1 billion => 1B, 1,490,000 => 1.5M, 999,999 => 1M
angular.module('utilsModule').filter("megaNumber", () => {
return (number, fractionSize) => {
if(number === null) return null;
if(number === 0) return "0";
if(!fractionSize || fractionSize < 0)
fractionSize = 1;
var abs = Math.abs(number);
@cwygoda
cwygoda / restful.py
Created February 13, 2013 21:08
Flask-Restful error handling without overriding Flask's error handling
from flask import request, Flask
from flask.ext import restful
class Api(restful.Api):
def __init__(self, app, prefix='', default_mediatype='application/json',
decorators=None):
super(Api, self).__init__(app, prefix, default_mediatype, decorators)