Skip to content

Instantly share code, notes, and snippets.

Avatar

Jack Mahoney jackmahoney

View GitHub Profile
@jackmahoney
jackmahoney / test-oauth2-verification-email-code.spec.js
Last active Feb 18, 2020
MailSlurp javascript client example
View test-oauth2-verification-email-code.spec.js
// import an apiKey and the official js client
const apiKey = require("./config.json").apiKey;
const MailSlurpClient = require("mailslurp-client");
// instantiate a client for the inbox endpoints
const api = new MailSlurpClient.InboxcontrollerApi();
// test the authentication flow on www.mailslurp.com
// using Cypress test runenr
describe("Emaile2e.com user signup", () => {
@jackmahoney
jackmahoney / ecs.tf
Last active Sep 25, 2018
ecs-cluster-service-task-definition
View ecs.tf
/*
ecs cluster and service definitions
*/
resource "aws_ecs_cluster" "ecs" {
name = "${var.name}-ecs"
}
/*
define ecs task for this app
*/
@jackmahoney
jackmahoney / config.js
Last active Apr 5, 2019
Vuepress Markdown Variable substitution
View config.js
// inside config.js extend webpack so that `__var_name__` is replaced with value of `config[var_name]`
// relies on npm install string-replace-loader
{
configureWebpack(config) {
config.resolve.alias["@"] = path.join(__dirname, "/theme");
config.resolve.alias["~"] = path.join(__dirname, "/public");
if (process.env.NODE_ENV === "production") {
const mappings = Object.keys(config).map(key => {
return { search: `__${key}__`, replace: config[key] }
})
View fetch-email-php-example.php
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use PHPUnit\Framework\TestCase;
/**
* This testsuite demonstrates how to use MailSlurp Email API Client in PHP
*
* MailSlurp let's you create real email addresses in PHP. You can then send and receive emails
* and attachments in PHP applications and tests.
@jackmahoney
jackmahoney / flatten.ts
Created Jul 7, 2020
Flatten an array of arrays or map of arrays in Typescript single liner
View flatten.ts
/**
* Flatten a map of arrays or array of arrays to a single array
* @param t
*/
export function flatten<T>(t: Array<Array<T>> | { [p: string]: Array<T> }): Array<T> {
return Object.values(t).reduce((mem, val) => [...mem, ...val], [])
}