Skip to content

@derek /gist:701418
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Node.js/YQL winner generator
/*
The winner generator for SoCal.js November meetup
Be sure to `npm install yql` first!
Written by Derek Gathright (@derek)
*/
var sys = require("sys"),
YQL = require('yql');
// Example #1
new YQL.exec("select from_user from twitter.search where q='@ydn and @coloft'", function(response) {
if (response.error) {
sys.puts("Example #1... Error: " + response.error.description);
}
else {
var max = response.query.results.results.length,
random = Math.floor(Math.random()*max),
winner = response.query.results.results[random].from_user;
winner = winner.substring(0, 8);
while(winner.length < 9) {
winner = winner += " ";
}
var unicorn = "\n\n" +
" \\\\ \n" +
" \\\\ \n" +
" \\\\\\\\ \n" +
" \\\\\\\\ \n" +
" __________ >\\\\/7 \n" +
"/ \\ _.-(6' \\\\ \n" +
"| " + winner + "|-(=___._/` \\\\ \n" +
"\\__________/ ) \\\\ | \n" +
" / / | \n" +
" / > / \n" +
" j < _\\\\ \n" +
" _.-' : ``. \n" +
" \\\\ r=._\\\\ `. \n" +
" <`\\\\\\\\_ \\\\ .`-. \n" +
" \\\\ r-7 `-. ._ ' . `\\ \n" +
" \\\\`, `-.`7 7) ) \n" +
" \\\\/ \\| \\' / `-._\n" +
" || .'\n" +
" \\\\ (\n" +
" >\\ >\n" +
" ,.-' >.'\n" +
" <.'_.''\n" +
" <'\n" +
"";
sys.puts(unicorn);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.