Skip to content

Instantly share code, notes, and snippets.

View wanderindev's full-sized avatar

Javier Feliu wanderindev

View GitHub Profile
FROM postgres:13.2-alpine
ADD init.sql /docker-entrypoint-initdb.d/
. . .
def requires_auth(permission=""):
def requires_auth_decorator(f):
@wraps(f)
def wrapper(*args, **kwargs):
permissions = get_jwt()["permissions"]
if not permissions:
raise AuthError(
{
class MemberModel(db.Model, ModelMixin):
__tablename__ = "members"
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(100), nullable=False, unique=True)
password_hash = db.Column(db.String(94), nullable=False)
mobile_phone = db.Column(db.String(15))
first_name = db.Column(db.String(50), nullable=False)
last_name = db.Column(db.String(50), nullable=False)
linkedin_profile = db.Column(db.String(75))
from typing import Union
class Node(object):
"""Node class consisting of data and a left / right branches"""
def __init__(self, data: Union[float, int, str]) -> None:
self.data = data
self.left = None
self.right = None
from typing import Union
class Node:
"""Node class consisting of data and a pointer to the next node"""
def __init__(
self,
data: Union[float, int, str],
next_node: Union["Node", None] = None,
import random
import time
from typing import List
def quicksort(l: List) -> List:
"""Recursive solution to performing quicksort on a list"""
# Base case
if len(l) <= 1:
return l
import time
import sys
def string_length(s: str) -> int:
"""Recursive solution to counting the characters of a string"""
# Base case
if len(s) <= 1:
return len(s)
# Recursive case
import time
import sys
from typing import List
def list_sum(l: List) -> float:
"""
Recursive solution to computing the sum of all elements in a
list of numbers
"""
import time
def gcd(a: int, b: int) -> int:
"""
Recursive solution to computing the greatest common divisor of
two integers a and b
"""
# Base case
if b == 0:
import time
def factorial(n: int) -> int:
"""Recursive solution to the factorial of n"""
# Base case
if n <= 1:
return 1
# Recursive case
else: