Skip to content

Instantly share code, notes, and snippets.

@trey
Created November 7, 2009 07:42
Show Gist options
  • Save trey/228607 to your computer and use it in GitHub Desktop.
Save trey/228607 to your computer and use it in GitHub Desktop.
How beards.trey.cc works. Be sure to note the YQL snippet at the bottom. Make your own at http://developer.yahoo.com/yql/console/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Beard Collection</title>
<meta name="description" content="Trey's collection of beardy things.">
<meta name="viewport" content="width=device-width, user-scalable=no">
<style type="text/css" media="screen">
body { color: #333; font: 14px "Helvetica Neue", Arial, sans-serif; }
#main { padding-top: 20px; }
h1,
#copyright { text-align: center; }
h1,
#main,
#copyright { width: 180px; margin: 0 auto; }
.caption { margin-bottom: 20px; }
a img { border: 0; }
h1 { font-size: 16px; text-align: center; }
#copyright { color: #999; font-size: 10px; text-align: center; margin-bottom: 20px; }
#copyright a { color: #666; }
</style>
<script src="http://www.google.com/jsapi"></script>
<script>google.load("jquery", "1.3.2");</script>
<script>
$(function() {
$.getJSON("http://query.yahooapis.com/v1/public/yql?q=use%20'http%3A%2F%2Fyqlblog.net%2Fsamples%2Fdata.html.cssselect.xml'%20as%20data.html.cssselect%3B%20select%20*%20from%20data.html.cssselect%20where%20url%3D%22http%3A%2F%2Fwhiskerino.org%2F2009%2Fbeards%2Ftrey%2Ffavorites%2F%22%20and%20css%3D%22%23gallerywidemouth%20div%22&format=json&diagnostics=false&callback=?",
function(data){
data.query.results.results.div.reverse();
$(data.query.results.results.div).each(function(index) {
$('<a>').attr('href', 'http://whiskerino.org/2009/' + this.a.href).append($('<img/>').attr('src', 'http://whiskerino.org/2009/' + this.a.img.src)).appendTo('#main');
$('<div class="caption">').html((this.h2)).appendTo('#main');
});
}
);
});
</script>
</head>
<body>
<h1>Trey's Favorite Beards</h1>
<div id="main">
</div><!-- #main -->
<div id="copyright">This little aggregation by<br> <a href="http://treypiepmeier.com/">Arthur L. Piepmeier III</a>.<br />View source to see the magic.</div>
</body>
</html>
use 'http://yqlblog.net/samples/data.html.cssselect.xml' as data.html.cssselect; select * from data.html.cssselect where url="http://whiskerino.org/2009/beards/trey/favorites/" and css="#gallerywidemouth div"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment