Skip to content

Instantly share code, notes, and snippets.

url = "http://www.wikipedia.org"
doc = Nokogiri::HTML(open(url))
icon = doc.search("link[@rel='shortcut icon']") | doc.search("link[@rel='icon']")
@icon_urls = icon.map {|i| i.attributes["href"].value()}
@kkxlkkxllb
kkxlkkxllb / nginx.conf
Created October 25, 2012 06:22
rails unicorn nginx config file cache
if (-f $request_filename) {
break;
}
if (-f $document_root/cache/$uri/index.html) {
rewrite (.*) /cache/$1/index.html break;
}
if (-f $document_root/cache/$uri.html) {
rewrite (.*) /cache/$1.html break;
require 'open-uri'
if Dir[@store_path+"*"].empty?
`rmdir #{@store_path}`
end
File.basename(url)
$("<%= escape_javascript render(:file => 'comments/new.html.erb') %>").insertAfter('#comments');
$('#new_comment').slideDown();
$('#new_comment_link').hide();