Skip to content

Instantly share code, notes, and snippets.

@rentalcustard
Last active June 1, 2016 14:58
Show Gist options
  • Save rentalcustard/aefeaea6732ab4d6d62c2a65786cffe1 to your computer and use it in GitHub Desktop.
Save rentalcustard/aefeaea6732ab4d6d62c2a65786cffe1 to your computer and use it in GitHub Desktop.
Small improvements thing
var nameWithAvatar = function(person) {
return person.name + ' (' + person.logo + ')';
}
var buildMessageText = function(message) {
return [message.title, message.message].join(" - ");
}
var buildMessage = function(message) {
return 'Praise from ' + nameWithAvatar(message.author) + ' for ' + message.recipients.map(nameWithAvatar).join(" and ") + ': ' + buildMessageText(message);
}
$('body').empty();
$.ajax({'url': 'https://soundcloud.small-improvements.com/api/v2/messages', success: function(messages) {
$(messages).each(function(index, message) {
console.log(buildMessage(message));
});
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment