Last active
June 1, 2016 14:58
-
-
Save rentalcustard/aefeaea6732ab4d6d62c2a65786cffe1 to your computer and use it in GitHub Desktop.
Small improvements thing
This file contains 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
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