Skip to content

Instantly share code, notes, and snippets.

View jasonamyers's full-sized avatar

Jason Myers jasonamyers

View GitHub Profile
@jasonamyers
jasonamyers / CreateUnsecuredFilteredAnnontationView.sql
Created March 23, 2012 17:52
MS CRM - New query to have an unsecured FilteredAnnotation View called FilteredAnnontationUS
create view [dbo].[FilteredAnnotationUS] (
annotationid,
createdby,
createdbydsc,
createdbyname,
createdbyyominame,
createdon,
createdonutc,
documentbody,
filename,
@jasonamyers
jasonamyers / CreateUnsecureFilteredEmailView.sql
Created March 23, 2012 17:53
MS CRM - Create Query to have an unsecured FilteredEmail view called FilteredEmailUS
create view [dbo].[FilteredEmailUS] (
activityid,
actualdurationminutes,
actualend,
actualendutc,
actualstart,
actualstartutc,
category,
compressed,
@jasonamyers
jasonamyers / MSCRMSelectNonEmailAttachments.sql
Created March 27, 2012 01:15
MS CRM: Select Non-email Attachments
SELECT
DocumentBody,
ObjectId,
FileName,
CONVERT(varchar(255), ObjectId) + '_' + CONVERT(varchar(255), Filename) AS SaveAsFileName
FROM
FilteredAnnotation
WHERE
@jasonamyers
jasonamyers / MSCRMSelectEmailAttachments.sql
Created March 27, 2012 01:16
MS CRM: Select Email Attachments
SELECT
EA.Body,
EA.ActivityID,
EA.AttachmentNumber,
EA.FileName,
CONVERT(varchar(255), EA.ActivityID) + '_' + CONVERT(varchar(255), EA.AttachmentNumber) + '_' + CONVERT(varchar(255), EA.Filename) AS SaveAsFileName
FROM
FilteredEmail E JOIN
ActivityMimeAttachment EA ON E.ActivityID = EA.ActivityID
@jasonamyers
jasonamyers / CreateUnsecureFilteredAppointmentView.sql
Created April 4, 2012 20:47
MS CRM - New query to have an unsecured FilteredAppointment View called FilteredAppointmentUS
create view [dbo].[FilteredAppointmentUS] (
activityid,
actualdurationminutes,
actualend,
actualendutc,
actualstart,
actualstartutc,
category,
ccs_administrativeevent,
ccs_administrativeeventname,
@jasonamyers
jasonamyers / CreateUnsecuredFilteredAccountView.sql
Created April 4, 2012 20:49
MS CRM - Create Query to have an unsecured FilteredAccount view called FilteredAccountUS
create view [dbo].[FilteredAccountUS] (
accountcategorycode,
accountcategorycodename,
accountclassificationcode,
accountclassificationcodename,
accountid,
accountnumber,
accountratingcode,
accountratingcodename,
address1_addressid,
@jasonamyers
jasonamyers / gist:3882612
Created October 13, 2012 00:39
GlucoTracker Goals

The idea of GlucoTracker is to make tracking and trending blood sugar levels easier and more accurate. It is exceptionally difficult to remember to test until it is too late. In addition to the everyday testing, once a quarter they must complete a test regiment that requires them to test prior to breakfast, 2 hours after eating, before lunch, 2 hours after eating lunch, dinner, 2 hours later, and bedtime. It's called an accucheck 360. Example PDF It is also important to spot trends in the measurements and alert the user to those trends. The main focus of the application is around making it accessible to seniors and fast for everyone. Blood sugar ranges from 0-1000, with the norm being 80-120 outside of the 2 hours after eating which should be no more than 1

@jasonamyers
jasonamyers / __formhelper.html
Created January 9, 2013 17:07
A VERY simple macro for rendering WTForms Fields in a bootstrap template
{% macro render_field(field) %}
<div {% if field.errors %}class="control-group error"{% else %}class="control-group"{% endif %}>
{% if field.name != "id" %}
<label class="control-label">{{ field.label }}</label>
{% endif %}
<div class="controls">
{{ field(**kwargs)|safe }}
{% if field.errors %}
{% for error in field.errors %}
<span class="help-inline">{{ error }}</span>
@jasonamyers
jasonamyers / Code that Creates it
Last active December 11, 2015 05:59
Wierd SQL Alchemy Error
def catalogs_home(request):
userid = authenticated_userid(request)
username = Users.by_id(userid).username
clients = DBSession.query(Clients).order_by(Clients.active).all()
commodities_count = []
sandbox_status = []
production_status = []
for client in clients:
category_count = 0
for category in client.categories:
@jasonamyers
jasonamyers / handle_cp.py
Created January 18, 2013 02:13
Parsing Pitney Errors
def handle_cp(message):
message = getattr(message, 'com.pb.clearpath.api.exception.CPAppException', None)
errdesc = None
if message:
while True:
if hasattr(message, 'exceptions'):
print "Exceptions"
if hasattr(message.exceptions, 'exceptions') or hasattr(message.exceptions, 'errors'):
message = message.exceptions