Feb 26, 2010

PCS, Moving, Home Buying Guide

Military.com page

Here is something I coded up, however, it was more repurposing the general news layout of the site to fit what was needed for this micro-site. I had to rebuild the entire center column while the left and right side columns were mostly reusable.

Check out the live version here.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • StumbleUpon

Feb 26, 2010

Magic HTML Machine

PHP/Javascript that automatically insert p tags

At my current job, I am a web producer so there’s a lot of formatting articles and then shoving them into a CMS. For the first few weeks of working here, I used to do it manually… one at a time. Then I started using Dreamweaver to do it with the ctrl+shift+p shortcut. One day sitting at home, I created a “tool” to do it for me with some simple regular expressions:

$edit = str_replace("\r\n\r\n","</p><p>",$text);

This was all fine and dandy for me but when you work with a company where some people like to copy and paste from MS Word, curly quotes can be an issue. I had opened my tool to a few coworkers initially and after curly quotes were an often enough problem, I implemented a search and replace for that while p tagging the content:

function convert_smart_quotes($string)
{
$search = array(chr(145),
chr(146),
chr(147),
chr(148),
chr(151));
 
$replace = array("'",
"'",
'"',
'"',
'-');
return str_replace($search, $replace, $string);
}
 
$text = convert_smart_quotes(htmlentities($_POST['text']));

Here is the finish product, not fancy or decorated at all since it’s just a tool for convenience.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • StumbleUpon

Feb 03, 2010

Under the Radar

Screen shot 2010-05-24 at 10.51.38 PM

Here’s a finished product which I mentioned working on earlier.

It was originally this theme here: Magnet. I was given a jpeg of what the end product should resemble and a psd of Magnet, the original theme. This project was different than other projects I’ve worked on because a) I wasn’t given a PSD to slice and dice into a layout. All the layout modifications (color changes, image editing, etc), I was left to do on my own. This gave me ample time to become really familiar of new techniques in Photoshop CS2. This also gave me the chance to work with WordPress in a professional environment, as opposed to personal uses.

Check out the live version here.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • StumbleUpon

Jan 09, 2010

Druids Rule Recoded

PHP/MySQL tool to compute game stats for World of Warcraft

I used to be an avid World of Warcraft gamer. The keyword is used to be. Back in 2008, I built a PHP tool to calculate some gaming stats. Basically it involved a lot of math. In sheer determination to fix up a lot of my personal projects, I went ahead and gave it a minimal simple new layout and cleaner xhtml.

There’s a bit of php math going on in this project (which was how I learned most of the php math I know today):

// formulas
$base_regen = 0.005575;
$mp5 = 5 * (0.001 + sqrt($int) * $spirit * $base_regen);
$mp5_from_gear = $head + $neck + $shoulder + $back + $chest + $bracers + $gloves + $waist + $pants + $boots + $ring1 + $ring2 + $trink1 + $trink2+ $weapon + $offhand + $idol;
$spirit_without_ls = $spirit - (floor($spirit * 0.15));
$mp5_without_ls = (0.001 + sqrt($int) * $spirit_without_ls * $base_regen);

One of these days, I’m going to find a better way to do all those calculations. Haha.

Check out the current version here.

  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • MySpace
  • Reddit
  • StumbleUpon