Created
March 4, 2010 04:49
-
-
Save darkhelmet/321408 to your computer and use it in GitHub Desktop.
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
function GithubBadge(json) { | |
if (json) { | |
var badge = new Object(); | |
badge['username'] = json.user.login; | |
badge['repos'] = _.select(json.user.repositories, function(r) { | |
return !r.fork && '' != r.description; | |
}).sort(function() { | |
return (Math.round(Math.random()) - 0.5); | |
}).slice(0, 12); | |
$('#github-badge').html(Jaml.render('github-badge', badge)); | |
if (!$.browser.msie) { $('a.github').tooltip(); } | |
} | |
} |
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
Jaml.register('repo', function(repo) { | |
li(a({ title: repo.description, cls: 'github', href: repo.url }, repo.name)); | |
}); | |
Jaml.register('github-badge', function(badge) { | |
div({ cls: 'github-badge' }, | |
h1({ cls: 'center' }, "What I'm Hacking"), | |
ul( | |
Jaml.render('repo', badge.repos), | |
li(a({ href: 'http://github.com/' + badge.username }, 'Fork me on Github, and see the rest of my code')) | |
) | |
); | |
}); |
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
Jaml.register('simple', function() { | |
div( | |
h1("Some title"), | |
p("Some exciting paragraph text"), | |
br(), | |
ul( | |
li("First item"), | |
li("Second item"), | |
li("Third item") | |
) | |
); | |
}); |
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
<div> | |
<h1>Some title</h1> | |
<p>Some exciting paragraph text</p> | |
<br /> | |
<ul> | |
<li>First item</li> | |
<li>Second item</li> | |
<li>Third item</li> | |
</ul> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment