Skip to content

Instantly share code, notes, and snippets.

@mwickett
Last active May 25, 2018 13:47
Show Gist options
  • Save mwickett/a6c0b6e48e73a093352bf5dddbbc9cfe to your computer and use it in GitHub Desktop.
Save mwickett/a6c0b6e48e73a093352bf5dddbbc9cfe to your computer and use it in GitHub Desktop.
Alfred script that creates a test email using the date and a random string
// This is meant to be used with Alfred app - https://www.alfredapp.com/
// Alfred drops args in as {query}
// Customize your default email address as you wish.
function run() {
let email = "{query}"
if (!email) email = '[email protected]'
const date = new Date()
.toISOString()
.substring(0, 10)
.split('-')
.join('')
const uuid = Math.random()
.toString(36)
.substring(2, 7)
const splitEmail = email.split('@')
return `${splitEmail[0]}+test${date}-${uuid}@${splitEmail[1]}`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment