Skip to content

Instantly share code, notes, and snippets.

@j4p3
j4p3 / utm-mirror
Created September 25, 2015 19:42
$.fn.utmMirror = function () {
if (window.location.search) {
var sep = this.attr('href').includes('?') ? '&' : '?';
this.attr('href', this.attr('href') + sep + window.location.search.substring(1));
}
}
@j4p3
j4p3 / oo_contact_adapter.py
Last active August 29, 2015 14:03
OO Contact Adapter Concept
def index():
motech_payload = get_payload_from_motech()
payload = FormattedResponse(motech_payload, 'index')
class FormattedResponse:
def __init__(self, payload, type):
if type == 'index':
# perform index-related processing
@j4p3
j4p3 / functional_contact_adapter.py
Last active August 29, 2015 14:03
Functional Contact Adapter Concept
def index():
motech_payload = get_stuff_from_motech()
self.__format_payload(motech_payload, 'index')
def __format_payload(self, payload, type):
"""
Call relevant restructuring methods for Motech response payload.
:payload: JSON payload.
:type: a string representing the type of request