This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* HOC fundamentally is just a function that accepts a Component and returns a Component: | |
(component) => {return componentOnSteroids; } or just component => componentOnSteroids; | |
Let's assume we want to wrap our components in another component that is used for debugging purposes, | |
it just wraps them in a DIV with "debug class on it". | |
Below ComponentToDebug is a React component. | |
*/ | |
//HOC using Class | |
//it's a function that accepts ComponentToDebug and implicitly returns a Class | |
let DebugComponent = ComponentToDebug => class extends Component { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bottle import route, run, auth_basic | |
from passlib.hash import sha256_crypt | |
def check_pass(username, password): | |
hashed = ''.join(redis.hmget(username, "password")) | |
return sha256_crypt.verify(password, hashed) | |
@route('/', method='GET') | |
@auth_basic(check_pass) # <-- decorator | |
def index(): |