Skip to content

Instantly share code, notes, and snippets.

@joewright
Created March 23, 2017 19:23
Show Gist options
  • Save joewright/8f781c37ab9b4a58dd7718fffbc0d311 to your computer and use it in GitHub Desktop.
Save joewright/8f781c37ab9b4a58dd7718fffbc0d311 to your computer and use it in GitHub Desktop.
Slack emoji count by author
var AUTHOR_DOM_QUERY = '.display_flex.align_items_center.break_word.bold';
doIt(AUTHOR_DOM_QUERY);
function doIt(query) {
// lucky for us, slack uses jQuery and lodash
return _.chain($(query).text().split('\n'))
.filter(hasLetters)
.map(trimEm)
.groupBy()
.mapValues('length')
.value();
}
function hasLetters(str) {
return str.match(/[a-z]/);
}
function trimEm(str) {
return str.trim();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment