upgrading to latest phusion passenger 2.1.2
super easy
gem install passenger
passenger-install-apache2-module
will walk you through the install and remember to copy paths to your apache config file. for passenger i kept it in
mods-available/passenger.conf and then linked it to mods-enabled
ln -s...
Written by Sean Behan on 06/17/2012
Extending Rails Form Builders
Extending forms in Rails is simple and will greatly reduce the amount of code in your views. This example is taken right from the Agile Web Development book on Rails(2.1.*) with one minor tweak. I want to pass a label argument along with the field name so...
Written by Sean Behan on 06/17/2012
Wildcard VirtualHost with Apache2
Set your ServerAlias directive to *.domain.tld - Here is a quick example.
<VirtualHost>
ServerName example.com
ServerAlias *.example.com
DocumentRoot /var/www/path/to/site
</VirtualHost>
Now everything.example.com and anything.example.co...
Written by Sean Behan on 06/17/2012
Highlight String in PHP
Function for highlighting text/strings in PHP.
$content = file_get_contents("http://php.net/");
print highlight("PHP", $content);
function highlight($match, $string){
return str_ireplace($match, "<span style='background:yellow'>$match</span&...
Written by Sean Behan on 06/17/2012
A Through Z
How to print the alphabet in Rails very easily.
("A".."Z").each {|letter| link_to letter, "/#{letter"}
"A".upto("Z") {|letter| link_to letter, "/#letter"}
Written by Sean Behan on 06/17/2012