Skip to content

Instantly share code, notes, and snippets.

@rowanmanning
Last active February 1, 2017 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rowanmanning/a73db383103ccb5f4cb55491658c66f1 to your computer and use it in GitHub Desktop.
Save rowanmanning/a73db383103ccb5f4cb55491658c66f1 to your computer and use it in GitHub Desktop.
Top 10 Slack Emoji Authors

Top 10 Slack Emoji Authors

Get a table containing the top 10 Slack emoji authors:

  1. Navigate to https://<your-org>.slack.com/customize/emoji

  2. Open the console

  3. Paste in the following and hit return:

    (function(){s=document.createElement('script');s.src='https://cdn.rawgit.com/rowanmanning/a73db383103ccb5f4cb55491658c66f1/raw/f5eb49584602af387dc48b327883992e5392c3a9/top-10-emoji-authors.js';document.body.appendChild(s);}());
    
  4. Enjoy!

(function() {
logEmojiAuthors();
function logEmojiAuthors() {
const authors = getTopTenEmojiAuthors();
console.table(authors);
}
function getTopTenEmojiAuthors() {
return getEmojiAuthors().sort(propertySorter('emojiCount')).reverse().slice(0, 9);
}
function getEmojiAuthors() {
const authorElements = Array.from(document.querySelectorAll('.author_cell'));
const authorNames = authorElements.map(element => element.textContent.trim());
const authorsByName = {};
authorNames.forEach(name => {
authorsByName[name] = authorsByName[name] || {
name: name,
emojiCount: 0
};
authorsByName[name].emojiCount += 1;
});
return Object.values(authorsByName);
}
function propertySorter(property) {
return (a, b) => {
if (a[property] < b[property]) {
return -1;
}
if (a[property] > b[property]) {
return 1;
}
return 0;
};
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment