Skip to content

Instantly share code, notes, and snippets.

Philip Martin pmart123

Block or report user

Report or block pmart123

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pmart123
pmart123 / contact_cleaner.py
Created Dec 19, 2018
Example code of cleaning contact names for CRM entry
View contact_cleaner.py
from collections import namedtuple
import probablepeople as pp
ContactName = namedtuple('ContactName', 'first last')
sample_names = [
ContactName('BOB', 'SMITH, JR'),
ContactName('Robert P.', 'Kardashian, CFA, CAIA'),
@pmart123
pmart123 / crm_example.py
Last active Dec 19, 2018
Getting data from outlook into CRM
View crm_example.py
# https://github.com/jasonjoh/python_tutorial/blob/master/tutorial/outlookservice.py#L89
import csv
import uuid
import requests
graph_endpoint = 'https://graph.microsoft.com/v1.0{0}'
def make_api_call(method, url, token, payload=None, parameters=None):
@pmart123
pmart123 / python_ideas_frozendict.py
Created Oct 10, 2018
Proposal for implementing frozendict in stdlib to cleanup implementing code that involves data mapping and conversions
View python_ideas_frozendict.py
"""
Proposal for implementing frozendict in stdlib to cleanup implementing code
that involves data mapping and conversions.
"""
from types import MappingProxyType
#####################################################
# Current way
#####################################################
@pmart123
pmart123 / sqlalchemy_views.py
Last active Oct 10, 2018
Sqlalchemy DDL with views error
View sqlalchemy_views.py
from sqlalchemy import (DDL, event, Column, TEXT, select, func,
FLOAT, CHAR, DATE, Table, table, MetaData)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import CreateColumn
from sqlalchemy.sql.ddl import _CreateDropBase
from sqlalchemy.ext.compiler import compiles
class _View(Table):
__visit_name__ = 'view'
@pmart123
pmart123 / understanding-word-vectors.ipynb
Created Mar 3, 2018 — forked from aparrish/understanding-word-vectors.ipynb
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
View understanding-word-vectors.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pmart123
pmart123 / sqlalchemy_server_updated_at.py
Last active Nov 1, 2017
Creating server side updated_at trigger
View sqlalchemy_server_updated_at.py
from sqlalchemy import Column, event, TIMESTAMP
from sqlalchemy.sql.expression import FunctionElement
from sqlalchemy.schema import DDLElement, FetchedValue
from sqlalchemy.ext import compiler
# DDL to create set_updated_at_timestamp function
UPDATED_AT_DDL_STATEMENT = """\
CREATE OR REPLACE FUNCTION set_updated_at_timestamp()
RETURNS TRIGGER AS $$
@pmart123
pmart123 / string_template.py
Created Apr 29, 2016
Metaclass idea for file patterns
View string_template.py
from functools import wraps
from inspect import Parameter, Signature
# ----------------------------------------------------------
# Helper Regular Expression str builders
# ----------------------------------------------------------
You can’t perform that action at this time.