Skip to content

Instantly share code, notes, and snippets.

View hugochinchilla's full-sized avatar
🤖
I'm not a robot

Hugo Chinchilla Carbonell hugochinchilla

🤖
I'm not a robot
View GitHub Profile
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports["material-ui"]=t(require("React"),require("ReactDOM")):e["material-ui"]=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=376)}([function(t,o){t.exports=e},function(e,t){e.exports=function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]
@hugochinchilla
hugochinchilla / model.py
Created March 24, 2017 18:38
sqlalchemy model base class with object manager
from sqlalchemy.ext.declarative import DeclarativeMeta, declarative_base
# it's up to you how your session object is created
from .session import session as default_session
class Manager(object):
YIELD_CURSOR_SIZE = 100
def __init__(self, model, session=None):
@hugochinchilla
hugochinchilla / alchemy_expression_wrapper.py
Created March 24, 2017 19:54
SqlAlchemy expression wrapper
from sqlalchemy.sql.elements import BinaryExpression
class C(object):
"""
This class is intend to be used in tests with unittest.mock.call
This class allows to wrap an sqlalchemy BinaryExpression in a way
you can compare a BinaryExpression agains a Wrapped BinaryExpression
to check if they are equivalent, as comparing them directly results