In ‘app/metal/deprecate_w_w_w.rb’:
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class DeprecateWWW
def self.call(env)
if env['HTTP_HOST'].slice!(/^www\./)
location = "#{env['rack.url_scheme']}://#{env['HTTP_HOST']}#{env['REQUEST_URI']}"
RAILS_DEFAULT_LOGGER.info "DeprecateWWW: Redirecting to #{location}"
[302, {'Location' => location}, []]
else
# A 400 status (Not Found) passes the call on to the next piece in the stack,
# which can be another metal piece, or your rails application.
[404, {"Content-Type" => "text/html"}, ["Not Found!"]]
end
end
end
For example, ‘http://www.solid1pxred.com/foobar’ would be redirected to ‘http://solid1pxred.com/foobar’
Many of the docs on gradient support in WebKit right now only include examples for “linear” style gradients, while just mentioning the syntax for “radial” styles:
-webkit-gradient(type, inner_center, inner_radius, outer_center, outer_radius, / stop...)
So here’s an example of how to do a “radial” background gradient:
background: -webkit-gradient(radial, left top, 30, left top, 100, color-stop(0.7, #7C95AC), from(#FFF), to(#304B67));
And here it is!
Behold… shortenTweet! It’s a wee microapp for Twitter that tries to shorten your tweets using UTF-8, ASCII and some shorthand. It’s a combination of Sinatra + jQuery, and after doing this I’m all aboard this microapp train (esp. with how easy it is to deploy Rack-based apps on Passenger).
And — par for the course — after I “launched” it, I discovered 2 or 3 or services that already did “tweet shortening” (although I don’t think any of them actually employ UTF-8).
Upgraded to Rails 2.3 today… very nice, but I ran into this
uninitialized constant CGI::Session
To solve, look for anywhere you reference the builtin session stores for rails (ie CookieStore), and change “CGI::Session” to “ActionController::Session”. (ie “CGI::Session::CookieStore” to “ActionController::Session::CookieStore”)
I’m pretty close to ditching my 3-year-old Typo/Joyent shared hosting blog setup soon. I might just replace it with this Tumblelog.
(apologies to anyone who was following my old blog feed)