Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / readme.md
Created February 3, 2016 18:56
DayWon API readme
@j4p3
j4p3 / frontend.txt
Created February 3, 2016 21:27
DayWon frontend libraries
angular-breadcrumbs.min.js
angular-cookies.min.js
angular-resource.min.js
angular-route.min.js
angular-touch.min.js
angular-ui-router.min.js
angular-will-paginate.js
angular.min.js
angulartics-ga.min.js
angulartics.min.js
@j4p3
j4p3 / gemfile.rb
Created February 3, 2016 21:28
DayWon API gemfile
source 'http://rubygems.org'
# API Core
ruby '2.0.0'
gem 'rails', '~> 4.0.1'
gem 'rails-api', '~> 0.1.0'
gem 'rabl', '~> 0.9.1'
gem 'json', '~> 1.8.1'
gem 'oj', '~> 2.7.3'
gem 'soft_deletion', '~> 0.5.6'
{
"color_scheme": "Packages/User/base16-ocean.dark (SL) (Flake8Lint).tmTheme",
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
"*.o",
// MAIN
export default class Main extends React.Component {
render() {
return (
<Router createReducer={reducerCreate}>
<Scene key='root'>
<Scene
key='drawer'
component={NavDrawer}>
<Scene key="main" tabs={true}>
{
"person": {
"name": "foo",
"score": 0.50
}
}
'use strict';
exports.handler = (event, context, callback) => {
// Extract request from the CloudFront event that is sent to Lambda@Edge
var request = event.Records[0].cf.request;
// Match any '/' that occurs at the end of a URI.
// Replace it with /index.html.
if (request.uri.match(/^((?!\.(css|js|html|xml|txt|ico|jpg|png|gif|json|pdf)$).)*$/)) {
request.uri = request.uri.replace(/\/$/, '/index.html');