hack snippets

How to get min-width and max-width working in IE 6

Tagged hack, min-width, max-width, ie6  Languages html

Far from optimal, but should work in most cases:

<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="ie6-is-a-shitty-browser.css" />
<![endif]-->
#wrapper { 
   width:expression(document.body.clientWidth < 950 ? "950px" : "100%" ); 
}

Note that users might get security warnings.

Hack for using OpenURI with SSL

Tagged openuri, ssl, hack, http  Languages ruby

This problem occurs with OpenURI and Ruby 1.8:

/usr/lib/ruby/1.8/net/http.rb:586:in connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: ce
rtificate verify failed (OpenSSL::SSL::SSLError)
        from /usr/lib/ruby/1.8/net/http.rb:586:in connect'
        from /usr/lib/ruby/1.8/net/http.rb:553:in do_start'
        from /usr/lib/ruby/1.8/net/http.rb:542:in start'
        from /usr/lib/ruby/1.8/open-uri.rb:242:in open_http'

With Ruby 1.9 you have an option to fix it like this:

open(uri,:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)

For Ruby 1.8 you could do this:

require 'open-uri'
require 'openssl'

url = 'https://www....'
proxy = 'http://...'

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

puts open(url, :proxy => proxy).read

Code found here