This file contains 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
FieldValue = Union[FieldStorage, str] | |
class MultipartMiddleware(Middleware): | |
MEDIA_FORM = "multipart/form-data" | |
METHODS_ALLOWED = {"PUT", "POST"} | |
def _get_field_val(self, field: FieldStorage) -> FieldValue: | |
""" | |
Returns input value for input text fields and FileStream object | |
""" |
This file contains 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 functools import wraps | |
class _Decorator: | |
""" Class Decorators""" | |
@classmethod | |
def func(cls, arg): | |
def wrapper(fn): | |
@wraps(fn) | |
def wrap(self, *args, **kwargs): |
This file contains 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 dataclasses import dataclass | |
from typing import Any | |
@dataclass | |
class EmptyNode: | |
data: Any | |
def __iter__(self): | |
return self.__generator__() |
This file contains 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
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
#include <map> | |
#include <string> | |
int randMove() { | |
return std::rand() % 3; | |
} |
This file contains 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 functools import reduce, partial | |
import random | |
import math | |
def calcMean(iterable): | |
return sum(iterable) / len(iterable) | |
def formatMean(mean): |
This file contains 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 functools import reduce | |
# Lets define a helper method to make it easy to use | |
def replacer(text, replacements): | |
return reduce( | |
lambda text, ptuple: text.replace(ptuple[0], ptuple[1]), | |
replacements, text | |
) | |
This file contains 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
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management | |
# 4. Searching | |
# 5. Process Management |
This file contains 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
# This method should be pretty clear | |
# it runs in O(n) time since I am going through the array of ints once | |
# it ONLY returns true if it succesfully finds the first occurence of my seq in the array of ints | |
def find_in_seq(array, seq_to_find): | |
# Track what has been popped | |
popped = [] | |
len_of_seq = len(seq_to_find) |
NewerOlder