Skip to content

Instantly share code, notes, and snippets.

View EdMan1022's full-sized avatar
💭
working

Edward Brennan EdMan1022

💭
working
  • Red Hat
  • Raleigh, NC
View GitHub Profile
def upload(line):
"""
Executes some operation using a dict and returns some output
This is where the Eloqua POST function would go,
I haven't implemented anything
:param line:
:return:
"""
return list(line.values())
def upload(line):
"""
Executes some operation using a dict and returns some output
This is where the Eloqua POST function would go,
I haven't implemented anything
:param line:
:return:
"""
raise NotImplementedError
@EdMan1022
EdMan1022 / inheritance_example.py
Created September 21, 2018 15:08
Quick dirty example of freely passing args to parent class
class ExampleParent(object):
def run(self, *args, **kwargs):
print(args[0])
print(kwargs['a'])
class ExampleChild(ExampleParent):
@EdMan1022
EdMan1022 / config.py
Created August 29, 2018 15:52
Flask config setup that utilizes a Singleton pattern to always return the same configuration instance when called multiple times. Could allow for other functions or methods to run and modify the config, and have those changes represented later on during app lifetime.
from os import environ
from logging.config import dictConfig
from werkzeug.security import generate_password_hash
class BaseConfig(object):
def _config_logger(self):
"""
from .base_model import BaseModel
from ..extensions import db
from .classes.foreign_key_cascade import ForeignKeyCascade
# Association table between Payment and Subscription
payment_subscription = db.Table(
'payment_subscription',
db.Column('payment_id', db.Integer, db.ForeignKey('payment.id'), primary_key=True),
db.Column('subscription_id', db.Integer, db.ForeignKey('subscription.id'),
primary_key=True)
import datetime
from dateutil.relativedelta import relativedelta
from dateutil.rrule import rrule, MONTHLY
today = datetime.datetime.today()
end1 = today + relativedelta(years=1)
end2 = today + relativedelta(years=2)
@EdMan1022
EdMan1022 / rrule_intersection.py
Created July 6, 2018 04:11
Creates an interval of monthly dates, but replacing weekend dates with the nearest weekday date
import datetime
from dateutil import rrule as rr, relativedelta as rd
start_date = datetime.datetime(year=2017, month=1, day=1)
end_date = datetime.datetime(year=2018, month=1, day=1)
# Generate rule for valid dates under simple rule (Monthly from start until end)
valid_rule = rr.rrule(freq=rr.MONTHLY, dtstart=start_date, until=end_date)
@EdMan1022
EdMan1022 / stack_overflow_question_49700822.ipynb
Created April 6, 2018 22:34
Scrap for stack overflow answer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@EdMan1022
EdMan1022 / form.json
Created January 15, 2018 00:35
form json example
{
"specifications":
{
"age": [
{
"min_age": "20",
"max_age": "25",
"sample_size": "20"
},
{
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
from voxco_survey_analysis.exceptions import InvalidUsage
from ..models import Analytic
def cluster_analysis_function(request):
"""
Perform a cluster analysis using the analysis group specified in the request