I really like this approach - it is much less invasive than the usual word verification. I haven't implemented comments here yet, but I'll probably apply this when I do.
Honeypot captcha
I really like this approach - it is much less invasive than the usual word verification. I haven't implemented comments here yet, but I'll probably apply this when I do.
Simplify your ruby hash injects with hmap
=> {"last_name"=>"Smith", "first_name"=>"John"}
>> x.inject({}){ |hash,(k,v)| hash.merge( k.to_sym => v) }
=> {:last_name=>"Smith", :first_name=>"John"}
How to extract a URL out of a string the easy way
Have you ever been tasked to convert all instances of a URL into a hyperlink from some source of text? Or perhaps you had to pipe all URL instances through a URL shortener?
I've had to do this from time to time over the last several years (the first stab a it was a miserable piece of code but got the job done), and every time I have had to deal with the same quirks: what if the URL is at the end of a sentence, what if it is at the end of a line, what if it is immediately followed by an html page break, etc.
Dear god, what have I done to deserve this?
Slicehost and Heroku compared for low volume web sites
Slicehost is an excellent hosting platform - I've been using them for some time now. However, in the interest of trying to drive costs down to absolute zero, I started evaluating Heroku as a platform to host this site.
Slicehost
If you're not familiar, Heroku and Slicehost differ structurally: Slicehost provides you with a virtual instance of Linux - most major distributions are available. It's your job to configure/manage the web application framework.
This opens a world of flexibilty - you can deploy any web-based solution you like backed by the database of your choosing. This is incredibly empowering - but you own everything, including downtime (at least downtime not incurred by Slicehost), maintenance updates, security, etc.