Skip to content

Instantly share code, notes, and snippets.

@leoriviera
Created January 19, 2025 21:08
Show Gist options
  • Save leoriviera/91cc1e852506b8bb17e6851ae180fa4b to your computer and use it in GitHub Desktop.
Save leoriviera/91cc1e852506b8bb17e6851ae180fa4b to your computer and use it in GitHub Desktop.
script to generate sankeymatic.com markup for job interview stages
const input = `
LinkedIn, Applied, Initial interview, Pending interview
cord.co (inbound), Applied, Initial interview, Pending response
cord.co (inbound), Applied, Pending response
cord.co (inbound), Applied, Initial interview, Pending response
Referral, Applied, Pending response
Search, Applied, Pending interview
cord.co (inbound), Applied, Initial interview, Pending response
Wellfound, Applied, Stalled
Speculative, Applied, Stalled
Wellfound, Applied, Stalled
LinkedIn, Applied, Stalled
cord.co (outbound), Applied, Stalled
cord.co (outbound), Applied, Stalled
Search, Applied, Stalled
LinkedIn, Applied, Initial interview, Rejected
LinkedIn, Applied, Rejected
LinkedIn, Applied, Rejected
eFinancialCareers, Applied, Rejected
LinkedIn, Applied, Initial interview, Technical exercise, Withdrew
Wellfound, Applied, Initial interview, Rejected
cord.co (outbound), Applied, Rejected
Search, Applied, Rejected
Search, Applied, Rejected
`;
const lines = input.trim().split("\n");
const pairCounts = {};
for (const line of lines) {
const stages = line.split(",");
if (stages.length <= 1) {
continue;
}
for (let index = 0; index < stages.length - 1; index++) {
const a = stages[index].trim();
const b = stages[index + 1].trim();
const key = `${a},${b}`;
if (!pairCounts[key]) {
pairCounts[key] = 0;
}
pairCounts[key] += 1;
}
}
const pairEntries = Object.entries(pairCounts).toSorted();
let results = "";
for (const entry of pairEntries) {
const [key, value] = entry;
const [a, b] = key.split(",");
results += `\n${a} [${value}] ${b}`;
}
console.log(results);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment