Created
January 8, 2021 11:56
-
-
Save mikaa123/58b800179e9c17fd7e8cf15d42224047 to your computer and use it in GitHub Desktop.
mock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="input"> | |
<textarea placeholder="jeremy, guillaume..."></textarea> | |
<input type="submit" onclick="mock();"/> | |
</div> | |
<p id="output" style="white-space: pre-wrap;"> | |
</p> | |
<script> | |
function mock() { | |
const result = [] | |
participants = document.querySelector("#input textarea").value.split(/, ?/) | |
function getRandom(arr, n) { | |
var result = new Array(n), | |
len = arr.length, | |
taken = new Array(len); | |
if (n > len) | |
throw new RangeError("getRandom: more elements taken than available"); | |
while (n--) { | |
var x = Math.floor(Math.random() * len); | |
result[n] = arr[x in taken ? taken[x] : x]; | |
taken[x] = --len in taken ? taken[len] : len; | |
} | |
return result; | |
} | |
function shuffle(array) { | |
var currentIndex = array.length, temporaryValue, randomIndex; | |
// While there remain elements to shuffle... | |
while (0 !== currentIndex) { | |
// Pick a remaining element... | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex -= 1; | |
// And swap it with the current element. | |
temporaryValue = array[currentIndex]; | |
array[currentIndex] = array[randomIndex]; | |
array[randomIndex] = temporaryValue; | |
} | |
return array; | |
} | |
// company | |
const companies = ["Partwear", "UTMedic", "DigitalTickets", "Readcut", "Fitnessgateway", "Gymblogs", "Foodvoice", "Savyspot", "Wellpanda", "Whooleague", "Gamereports", "Bestbought"] | |
const currentSearch = ["None", "Elastic", "Klevu", "Doofinder", "Attraqt", "Bloomreach", "FactFinder", "Loop54", "Intershop"] | |
const stacks = ["PHP", "Ruby", "JS", "Python", "Swift", "Kotlin", "Android", ".NET", "Go", "Scala", "Rails", "Symphony", "Django", "Laravel", "Magento1", "Magento2", "WordPress", "Shopify", "SFCC"] | |
const painlist = ["Slow indexing - takes 6 hours", "Huge volume of data", "Slow search", "Bad relevance", "No project identified", "IT and business dont speak", "Language handling", "SEO", "Integration with stack", "No dev team"] | |
const roles = ["CTO", "CEO", "Lead Dev", "Data Analyst", "PM", "UX Designer", "Merchandizer"] | |
function pickCompany() { | |
const prospect = companies[Math.floor(Math.random() * companies.length)]; | |
result.push("## Prospect") | |
result.push(prospect) | |
} | |
function pickCurrentSearch() { | |
const current = currentSearch[Math.floor(Math.random() * currentSearch.length)]; | |
result.push("## Current search") | |
result.push(current) | |
} | |
function pickStack() { | |
const stack = stacks[Math.floor(Math.random() * stacks.length)]; | |
result.push("## Stack") | |
result.push(stack) | |
} | |
function pickPains() { | |
const pains = getRandom(painlist, Math.floor(Math.random() * painlist.length)) | |
result.push("## Pains") | |
result.push(pains) | |
} | |
function pickParticipants() { | |
participants = shuffle(participants) | |
allRoles = ["AE", "SE"].concat(shuffle(roles)) | |
result.push("## Participants") | |
for (let i = 0; i < participants.length; ++i) { | |
result.push(participants[i] + " " + allRoles[i]) | |
} | |
} | |
result.push("# Mock call brief") | |
pickCompany() | |
result.push("") | |
pickStack() | |
result.push("") | |
pickCurrentSearch() | |
result.push("") | |
pickPains() | |
result.push("") | |
pickParticipants() | |
document.querySelector("#output").textContent = result.join("\n") | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment