Tuesday, July 29, 2008

Monday, July 7, 2008

Two videos that made me smile last week

Where the Hell is Matt?




Usher - Love In This Club (Performed by Showbiz Pizza Band)

Tuesday, June 24, 2008

regex replace part of a match in PHP

So, I'm working in PHP on the new company site, and we're pulling all sorts of feeds from our blogs and showing them on the site. I'm using Magpie RSS to do this, and for the most part works really well, except for funny characters. You know, the ones you get in Word that look just a little different. They're pretty awesome. Well, Magpie RSS handles them awesome too. It replaces all of these funny characters with one type of character - the question mark. Now I usually enjoy that little guy, its all squiggly and informs you to intonate correctly at the end of a sentence, but here the big Q is a pain in the ascot. And I can never remember how to replace only part of a match in regular expressions, so I am writing the PHP syntax down.

For example, I have the improperly formatted text "Charlie?s Angels"

I can use preg_replace and group the different sets matching characters with parens:

/(\?)([a-zA-Z])/

So this matches the ?s and groups the '?' and the 's' seperately which can be used as back references in my replace string with the characters $1 and $2 respectively. $0 refers to the whole match and back references work with numbers 1 through 9.

The full expression would be

$str = "Charlie?s Angels";
$s = preg_replace("/(\?)([a-zA-Z])/", "'$2", $str);

Now if only I can keep this in my noggin for a while...

Thursday, June 5, 2008

Monday, March 24, 2008

Work Quotes

"Someone's going to have to come sit in the big comfy"

"I saw someone ice fishing this morning" me (it's march 24)
"They're out there in like fucking July" my boss

Tuesday, March 18, 2008

Happy St. Patty's Day

At the bar last night, our friends ordered some green beer. It was kinda of pale - a light green color. On their second round, the bartender hands them much greener beers. The original beer holder says, "Hey! How come theirs are darker than mine?"

The bartender replies "How green it is depends on how much food coloring I put in."

Priceless.

Wednesday, March 12, 2008

Tuesday, March 4, 2008

Quotes of note

Vision without action is a daydream. Action without vision is a nightmare.
-Japanese Proverb

Every morning in Africa, a gazelle wakes up.
It knows it must outrun the fastest lion or it will be killed.
Every morning in Africa, a lion wakes up.
It knows that it must run faster than the slowest gazelle, or it will starve.
It doesn't matter whether you're a lion or a gazelle
when the sun comes up you'd better be running.

Cowards die many times before their deaths, the valiant never taste death but once.
--Julius Ceaser

Our greatest glory is not in never falling, but in rising every time we fall.
-- Confucius

All it takes is all you got.
--Marc Davis

You have a choice. You can throw in the towel, or you can use it to wipe the sweat off of your face.

Shoot for the moon. Even if you miss it you will land among the stars
- Les Brown

Saturday, March 1, 2008

Mos Def Kick

Mos Def an Talib Kwali



Miss Fat Booty



I can't stop listening to Timbaland presents Shock Value right now...

Friday, February 29, 2008

Theodore Roosevelt

I wish to preach, not the doctrine of ignoble ease, but the doctrine of the strenuous life, the life of toil and effort, of labor and strife; to preach that highest form of success which comes, not to the man who desires mere easy peace, but to the man who does not shrink from danger, from hardship, or from bitter toil, and who out of these wins the splendid ultimate triumph. - Theodore Roosevelt

Thursday, February 28, 2008

Quotes

"When the going gets tough, the tough gets going" - Mom

"Make sure you're getting out and running, or skiing" - Mom

Tuesday, February 19, 2008

Flux Video

Bloc Party is awesome.

Monday, February 4, 2008

Tuesday, January 29, 2008

Courage

This is great. find it here