jekyll / jekyll-avatar

A Jekyll plugin for rendering GitHub avatars
MIT License
89 stars 9 forks source link

Confirm we're doing it right #1

Closed benbalter closed 8 years ago

benbalter commented 8 years ago

@technoweenie, when you get a chance (absolutely no rush), hoping to once again borrow some of your avatar expertise, as this plugin is an attempt to put into (broader) practice your guidance from https://github.com/github/government.github.com/pull/406 (regarding using avatar0-3 to ensure caching and load avatars in parallel).

You can see all ~50 lines in https://github.com/benbalter/jekyll-avatar/blob/master/lib/jekyll/avatar.rb, if you're interested, but the key bits:

To calculate avatars0-3:

Zlib.crc32(path) % SERVERS

(where SERVERS is 4)

The resulting output:

<img class="avatar avatar-small" src="https://avatars3.githubusercontent.com/hubot?v=3&amp;s=40" alt="hubot" width="40" height="40" />

Any red flags / potential improvements there? Seeing how often we use this on GitHub-properties alone, figured it be worth putting things into a Jekyll plugin to codify best practices.

/cc @parkr

technoweenie commented 8 years ago

Looks fine, that's still what we're using:

https://github.com/github/github/blob/7a6943bd0cba4d1c33a30fa9b157bf82e453ca21/lib/github/config.rb#L3032-L3043

benbalter commented 8 years ago

:metal: Thanks @technoweenie!