Skip to content

Instantly share code, notes, and snippets.


Eric Johnson singledigit

View GitHub Profile
singledigit / Custom Validation
Last active Sep 18, 2015
Aurelia-Validation: My approach at centralizing the validation and still being able to use custom-validation
View Custom Validation
import moment from 'moment';
export function isValidDate(fmt) {
let dateFormat = fmt || 'MM/DD/YYYY';
this.passes((newValue) => {
let mmt = moment(newValue, dateFormat);
return mmt.isValid() && mmt.format(dateFormat) === newValue;
return this;
View Aurelia Storage Class
* Created by ericjohnson on 10/6/15.
import moment from 'moment';
export class Storage {
constructor() {
this.index = {}; = window.localStorage;
singledigit / action-intent-request.js
Last active Feb 25, 2016
Alexis Skill Skeleton Files
View action-intent-request.js
* Created by ericjohnson on 2/23/16.
let model = require('./response-model'),
utilities = require('./utilities'),
ActionLaunchRequest = require('./action-launch-request'),
client = require('api-client');
export function intent(event, context) {
View index.html
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css">
<h1>Hello world!</h1>
<script src="script.js"></script>
singledigit / Auth Class
Last active May 2, 2018
Pattern for using Cognito User Pools as authentication against Cognito Identity
View Auth Class
import {inject} from 'aurelia-framework';
import {Session} from './session';
export class Auth {
// App specific
userPoolId = 'us-east-1_fgCWraBkF';
appClientId = '57lq262n28o7ddt8i36jcjj7qd';
singledigit / Activate
Last active Feb 11, 2021
Code examples for Serverless Architecture Demo part 3
View Activate
return this.auth.getSession();
singledigit / aureila-dynamic-validation-rules.js
Last active Oct 11, 2016
Dynamically build Aurelia Validation rules.
View aureila-dynamic-validation-rules.js
//This is a rough attempt at dynamically building validation rules based on a JSON document.
let rules = [];
Forms[this.viewing].map(field => {
if(field.required && !field.viewIf){
if (field.required && field.viewIf) {
singledigit / Base File
Last active Jun 7, 2018
Cloudformation Files for Creating a Serverless CICD Pipeline
View Base File
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Deployment Stack'
NoEcho: true
Type: String
Description: Secret. It might look something like 9b189a1654643522561f7b3ebd44a1531a4287af OAuthToken with access to Repo. Go to"
Type: String
Description: GitHub UserName
singledigit / Usage
Last active Mar 27, 2017
Aurelia value-converter allowing two string values to be used as a checkbox boolean
View Usage
<input type="checkbox" checked.bind="color | checkedValue:'Green':'Blue'" />
singledigit / cognito.yaml
Last active Mar 23, 2021
Create a Cognito Authentication Backend via CloudFormation
View cognito.yaml
AWSTemplateFormatVersion: '2010-09-09'
Description: Cognito Stack
Type: String
Description: Unique Auth Name for Cognito Resources
# Creates a role that allows Cognito to send SNS messages