Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// groovyistList
def groovyistList = [
'@orange_clover' : 'http://a2.twimg.com/profile_images/1568026111/orange_clover_Groovyist.png',
'@nightmare_tim' : 'http://a3.twimg.com/profile_images/1550122033/_____110919.jpg_groovy.png',
'@hina0118' : 'http://a3.twimg.com/profile_images/1527524020/02_27_b08_011.jpg_groovy.png',
'@neiraza' : 'http://a2.twimg.com/profile_images/1464918444/tw_icon.jpg_groovy.png',
'@tkdysk' : 'http://a1.twimg.com/profile_images/1435365281/Groovyist.png',
'@toby55kij' : 'http://a1.twimg.com/profile_images/1435166270/toby55kij_groovy3.png',
'@uehaj' : 'http://a0.twimg.com/profile_images/1458232042/suzume.jpg_groovy.png',
'@kyon_mm' : 'http://a0.twimg.com/profile_images/1388079821/IMAG0300_small.JPG_groovy_reasonably_small.png',
'@kimukou_26' : 'http://a2.twimg.com/profile_images/1458579347/65.png_groovy.png',
'@mike_neck' : 'http://a2.twimg.com/profile_images/1377058283/mike_groovy.png',
'@irof' : 'http://a0.twimg.com/profile_images/1429095242/icon_twitter9.GIF_groovy.png',
'@mittie' : 'http://a1.twimg.com/profile_images/347548040/twitterProfilePhoto.jpg',
'@glaforge' : 'http://a1.twimg.com/profile_images/347708182/twitterProfilePhoto.jpg',
'@pocketberserker' : 'http://a0.twimg.com/profile_images/1372211575/20070620184601.jpg_groovy.png',
'@take_o' : 'http://a1.twimg.com/profile_images/1454627793/origin12716028212770.jpg_groovy.png',
'@nobeans' : 'http://a1.twimg.com/profile_images/1369820988/yasuharu-mameshiba.png_groovy.png',
'@ikikko' : 'http://a1.twimg.com/profile_images/1378810709/profile.gif_groovy.png',
'@40balmung' : 'http://a2.twimg.com/profile_images/1466699768/main_icon2.png_groovy.png',
'@bluepapa32' : 'http://a2.twimg.com/profile_images/1372356653/DSC00470b.jpg_groovy.png',
'@ponkichi_7' : 'http://a3.twimg.com/profile_images/1469324970/profile_bigger.png_groovy.png',
'@fumokmm' : 'http://a3.twimg.com/profile_images/1391984646/fumokmm.jpg'
]
def toHatenaNotation(item) {
"${item.key != 'zzzzz' ? '[twitter:' + item.key + ']': 'New Groovyist'}|<img style=\"width:150px; height:150px\" src=\"${item.value}\"/>"
}
// header
println "|${(['TwitterID', 'アイコン'].collect{ "*$it" } * 2).join('|')}|"
// body
groovyistList.with {
if (it.size() % 2 != 0) {
it['zzzzz'] = 'http://cdn-ak.f.st-hatena.com/images/fotolife/f/fumokmm/20110730/20110730224024.jpg?1312033242'
}
it
}.sort{it.key}.entrySet().toList().with { kvList ->
if (kvList.size() % 2) kvList << new HashMap.Entry(' ', ' ')
[(0..<kvList.size()).toList(), kvList].transpose()
}.with {
[ it.findAll{ !(it[0]%2) },
it.findAll{ it[0]%2 } ].transpose()
}.collect { it.collect{ it[1] } }.each {
println "|${toHatenaNotation(it[0])}|${toHatenaNotation(it[1])}|"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment