Skip to content

Instantly share code, notes, and snippets.

View cantino's full-sized avatar
💭
1AU

Andrew Cantino cantino

💭
1AU
View GitHub Profile
// query: select * from html where url="http://some.url.com" and xpath='//title'
var yql_url = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22" + encodeURIComponent(url) + "%22%20and%0A%20%20%20%20%20%20xpath%3D'%2F%2Ftitle'&format=json&callback=?";
$.getJSON(yql_url, function(json) {
if (json && json.query && json.query.results && json.query.results.title) {
$('#page_title').html(json.query.results.title);
}
});
# Ruby's TSort requires that you implement
# tsort_each_node and tsort_each_child. I
# extend Array so that it knows how to
# TSort instances of Project, which has a
# child_project_id pointing to another
# Project.
require 'tsort'
class Array
@cantino
cantino / README.md
Last active August 29, 2015 14:27
Ruby each_codepoint hangs on IO stream
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 2. in line 2.
San Francisco 4821
London 1409
Seattle, WA 1083
New York, NY 2056
Portland, OR 949
Chicago, IL 930
Tokyo, Japan 1518
London, UK 894
japan 880
Germany 856
@cantino
cantino / output.md
Last active August 29, 2015 14:16
A breadth-first Tower of Hanoi solver in Go

Example Output

Lower numbers in the towers represent larger disks, so higher integers must always be to the right of smaller ones.

World:
0 [1]
1 [2]
2 [3 4 5 6]
---------------